(self,
                 input_text=None,
                 tagged=None,
                 entities=None)
A sentence object.

        :param input_text: raw input text as a string
        :param tagged: a list of dict objects, one per token, with the output of the POS and NER taggers, see utils
                      for more info
        :param entities: a list of tuples, where each tuple is an entity link (first position is the KB id and
                         the second position is the label)
A sentence object.
A sentence object .
def __init__(self,
                 input_text=None,
                 tagged=None,
                 entities=None):
        """
        A sentence object.

        :param input_text: raw input text as a string
        :param tagged: a list of dict objects, one per token, with the output of the POS and NER taggers, see utils
                      for more info
        :param entities: a list of tuples, where each tuple is an entity link (first position is the KB id and
                         the second position is the label)
        """
        self.input_text = input_text if input_text else ""
        self.tagged = tagged if tagged else []
        self.tokens = [t['originalText'] for t in self.tagged]
        self.entities = [{k: e[k] for k in {'type', 'linkings', 'token_ids'}} for e in entities] if entities else []
        self.entities += [{'type': 'YEAR', 'linkings': [(t['originalText'], t['originalText'])], 'token_ids': [t['index']-1]}
                          for t in self.tagged if t['pos'] == 'CD' and t['ner'] == 'DATE']
        if get_question_type(self.input_text) == "person":
            self.entities.append({'type': 'NN', 'linkings': [("Q5", 'human')], 'token_ids': [0]})
        if get_question_type(self.input_text) == "location":
            self.entities.append({'type': 'NN', 'linkings': [("Q618123", 'geographical object')], 'token_ids': [0]})
        self.graphs = [WithScore(SemanticGraph(free_entities=self.entities, tokens=self.tokens), (0.0, 0.0, 0.0))]
def __init__ ( self , input_text = None , tagged = None , entities = None ) : self . input_text = input_text if input_text else "" self . tagged = tagged if tagged else [ ] self . tokens = [ t [ 'originalText' ] for t in self . tagged ] self . entities = [ { k : e [ k ] for k in { 'type' , 'linkings' , 'token_ids' } } for e in entities ] if entities else [ ] self . entities += [ { 'type' : 'YEAR' , 'linkings' : [ ( t [ 'originalText' ] , t [ 'originalText' ] ) ] , 'token_ids' : [ t [ 'index' ] - 1 ] } for t in self . tagged if t [ 'pos' ] == 'CD' and t [ 'ner' ] == 'DATE' ] if get_question_type ( self . input_text ) == "person" : self . entities . append ( { 'type' : 'NN' , 'linkings' : [ ( "Q5" , 'human' ) ] , 'token_ids' : [ 0 ] } ) if get_question_type ( self . input_text ) == "location" : self . entities . append ( { 'type' : 'NN' , 'linkings' : [ ( "Q618123" , 'geographical object' ) ] , 'token_ids' : [ 0 ] } ) self . graphs = [ WithScore ( SemanticGraph ( free_entities = self . entities , tokens = self . tokens ) , ( 0.0 , 0.0 , 0.0 ) ) ]