Construct an AnalysisGraph object from text, using Eidos to perform
        machine reading.
513383
def from_text(cls, text: str):
        

        eidosProcessor = process_text(text)
        return cls.from_statements(eidosProcessor.statements)
134586
def tokenize_list(self, text):
        
        return [self.get_record_token(record) for record in self.analyze(text)]
545661
def from_lines(lines: Iterable[str], **kwargs) -> BELGraph:
    
    graph = BELGraph()
    parse_lines(graph=graph, lines=lines, **kwargs)
    return graph
163791
def eidos_process_text():
    """"""
    if request.method == 'OPTIONS':
        return {}
    req = request.body.read().decode('utf-8')
    body = json.loads(req)
    text = body.get('text')
    webservice = body.get('webservice')
    if not webservice:
        response.status = 400
        response.content_type = 'application/json'
        return json.dumps({'error': 'No web service address provided.'})
    ep = eidos.process_text(text, webservice=webservice)
    return _stmts_from_proc(ep)
51926
def from_text(text):
    """"""

    # 'text' can also be a file, but we don't publish that fact
    # since it's an implementation detail.  The official file
    # interface is from_file().

    m = Message()

    reader = _TextReader(text, m)
    reader.read()

    return m
355914
def _parse_rdf(self, file):
        
        store = Graph()
        store.parse(file)

        print len(store)
891694
@Override
	void analyzeWords(AnalyzedText aText) {
		FastList<String> list = new FastList<String>();
		FastSet<String> set = new FastSet<String>();

		com.chenlb.mmseg4j.Word word = null;
		Reader sr = new StringReader(aText.getText());
		synchronized(mmSeg){
			mmSeg.reset(sr);
			try{
				while((word=mmSeg.next())!=null) {
					String w = word.getString();
					list.add(w);
					set.add(w);
				}
			}catch(IOException e){
				throw new RuntimeException("IOException occurred", e);
			}
		}
		aText.setWords(list);
		aText.setUniqueWords(set);
	}
634973
def extract_from_text(text):
    
    return tools.remove_duplicates([i[0]
                                    for i in REGEX.findall(text) if i != ''])
955589
def text_to_data(self, text, elt, ps):
        '''
        '''
        if self.strip: text = text.strip()
        if self.pyclass is not None:
            return self.pyclass(text.encode(UNICODE_ENCODING))
        return text.encode(UNICODE_ENCODING)
1363502
def nltk_tokenzier_factory(nltk_tokenizer):
	'''
	
	'''

	def tokenize(text):
		toks = []
		for tok in nltk_tokenizer.tokenize(text):
			if len(tok) > 0:
				toks.append(Tok(_get_pos_tag(tok),
				                tok.lower(),
				                tok.lower(),
				                ent_type='',
				                tag=''))
		return Doc([toks], text)

	return tokenize
906098
def load_text_data(dataset, directory, centre=True):
    """"""

    points, point_names = parse_text(os.path.join(directory, dataset + '.txt'))[0:2]
    # Remove markers where there is a NaN
    present_index = [i for i in range(points[0].shape[1]) if not (np.any(np.isnan(points[0][:, i])) or np.any(np.isnan(points[0][:, i])) or np.any(np.isnan(points[0][:, i])))]

    point_names = point_names[present_index]
    for i in range(3):
        points[i] = points[i][:, present_index]
        if centre:
            points[i] = (points[i].T - points[i].mean(axis=1)).T 

    # Concatanate the X, Y and Z markers together
    Y = np.concatenate((points[0], points[1], points[2]), axis=1)
    Y = Y/400.
    connect = read_connections(os.path.join(directory, 'connections.txt'), point_names)
    return Y, connect
140952
def _create_sentence_objects(self):
        """"""
        sentence_objects = []
        sentences = sent_tokenize(self.raw, tokenizer=self.tokenizer)
        char_index = 0  # Keeps track of character index within the blob
        for sent in sentences:
            # Compute the start and end indices of the sentence
            # within the blob. This only works if the sentence splitter
            # does not perform any character replacements or changes to
            # white space.
            # Working: NLTKPunktTokenizer
            # Not working: PatternTokenizer
            try:
                start_index = self.raw.index(sent, char_index)
                char_index += len(sent)
                end_index = start_index + len(sent)
            except ValueError:
                start_index = None
                end_index = None
            # Sentences share the same models as their parent blob
            s = Sentence(
                sent,
                start_index=start_index,
                end_index=end_index,
                tokenizer=self.tokenizer,
                np_extractor=self.np_extractor,
                pos_tagger=self.pos_tagger,
                analyzer=self.analyzer,
                parser=self.parser,
                classifier=self.classifier)
            sentence_objects.append(s)
        return sentence_objects
93068
def analyzePython(code_text):
        
        code, comment, docstr = 0, 0, 0

        p1 = r"""(?<=%s)[\s\S]*?(?=%s)""" % ('"""', '"""')
        p2 = r"""(?<=%s)[\s\S]*?(?=%s)""" % ("'''", "'''")

        # count docstr
        for pattern in [p1, p2]:
            for res in re.findall(pattern, code_text)[::2]:
                lines = [i.strip() for i in res.split("\n") if i.strip()]
                docstr += len(lines)

        # count comment line and code
        lines = [i.strip() for i in code_text.split("\n") if i.strip()]
        for line in lines:
            if line.startswith("#"):
                comment += 1
            else:
                code += 1
        purecode = code - docstr  # pure code = code - docstr
        return code, comment, docstr, purecode
1335658
def mols_from_text(text, no_halt=True, assign_descriptors=True):
    
    if isinstance(text, bytes):
        t = tx.decode(text)
    else:
        t = text
    # Lazy line splitter. More efficient memory usage than str.split.
    exp = re.compile(r"[^\n]*\n|.")
    sp = (x.group(0) for x in re.finditer(exp, t))
    for c in mol_supplier(sp, no_halt, assign_descriptors):
        yield c
620966
def parse(self, text):
        
        root = ET.fromstring(text)
        for elm in root.findall('{http://www.iana.org/assignments}registry'):
            for record in elm.findall('{http://www.iana.org/assignments}record'):
                for fileElm in record.findall('{http://www.iana.org/assignments}file'):
                    if fileElm.get('type') == 'template':
                        mimeType = fileElm.text.strip()
                        yield mimeType
                        break
43165
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'language' in _dict:
            args['language'] = _dict.get('language')
        if 'analyzed_text' in _dict:
            args['analyzed_text'] = _dict.get('analyzed_text')
        if 'retrieved_url' in _dict:
            args['retrieved_url'] = _dict.get('retrieved_url')
        if 'usage' in _dict:
            args['usage'] = AnalysisResultsUsage._from_dict(_dict.get('usage'))
        if 'concepts' in _dict:
            args['concepts'] = [
                ConceptsResult._from_dict(x) for x in (_dict.get('concepts'))
            ]
        if 'entities' in _dict:
            args['entities'] = [
                EntitiesResult._from_dict(x) for x in (_dict.get('entities'))
            ]
        if 'keywords' in _dict:
            args['keywords'] = [
                KeywordsResult._from_dict(x) for x in (_dict.get('keywords'))
            ]
        if 'categories' in _dict:
            args['categories'] = [
                CategoriesResult._from_dict(x)
                for x in (_dict.get('categories'))
            ]
        if 'emotion' in _dict:
            args['emotion'] = EmotionResult._from_dict(_dict.get('emotion'))
        if 'metadata' in _dict:
            args['metadata'] = AnalysisResultsMetadata._from_dict(
                _dict.get('metadata'))
        if 'relations' in _dict:
            args['relations'] = [
                RelationsResult._from_dict(x) for x in (_dict.get('relations'))
            ]
        if 'semantic_roles' in _dict:
            args['semantic_roles'] = [
                SemanticRolesResult._from_dict(x)
                for x in (_dict.get('semantic_roles'))
            ]
        if 'sentiment' in _dict:
            args['sentiment'] = SentimentResult._from_dict(
                _dict.get('sentiment'))
        if 'syntax' in _dict:
            args['syntax'] = SyntaxResult._from_dict(_dict.get('syntax'))
        return cls(**args)
1298663
def analyse(content, splitlines=True, format=None, **kwargs):
    '''  '''
    sents = DekoText.parse(content, splitlines=splitlines, **kwargs)
    doc = []
    final = sents
    # Generate output
    if format == 'html':
        for sent in sents:
            doc.append(sent.to_ruby())
        final = '<br/>\n'.join(doc)
    elif format == 'csv':
        for sent in sents:
            doc.append('\n'.join([x.to_csv() for x in sent]) + '\n')
        final = '\n'.join(doc)
    elif format == 'txt':
        final = '\n'.join([str(x) for x in sents])
    return final