run_ner.py
def _read_sentence(self, input_file):
        """Reads a tab separated value file."""
        lines = []
        words, labels = [], []
        for line in open(input_file, encoding="utf-8"):
            line = line.strip()
            if len(line) == 0 and len(words) > 0:
                lines.append((" ".join(words), " ".join(labels)))
                words, labels = [], []
            else:
                if len(line.split(" ")) != 2:
                    continue
                word, label = line.split(" ")
                words.append(word)
                labels.append(label)
        return lines
Reads a tab separated value file.
Reads a tab separated value file.
Reads a tab separated value file .
def _read_sentence(self, input_file):
        lines = []
        words, labels = [], []
        for line in open(input_file, encoding="utf-8"):
            line = line.strip()
            if len(line) == 0 and len(words) > 0:
                lines.append((" ".join(words), " ".join(labels)))
                words, labels = [], []
            else:
                if len(line.split(" ")) != 2:
                    continue
                word, label = line.split(" ")
                words.append(word)
                labels.append(label)
        return lines
def _read_sentence ( self , input_file ) : lines = [ ] words , labels = [ ] , [ ] for line in open ( input_file , encoding = "utf-8" ) : line = line . strip ( ) if len ( line ) == 0 and len ( words ) > 0 : lines . append ( ( " " . join ( words ) , " " . join ( labels ) ) ) words , labels = [ ] , [ ] else : if len ( line . split ( " " ) ) != 2 : continue word , label = line . split ( " " ) words . append ( word ) labels . append ( label ) return lines
Reads a tab separated value file.
Reads a tab separated value file .
"""Reads a tab separated value file."""
self
input_file