Esempio n. 1
0
File: api.py Progetto: pocketman/nlp
def parseS(s):
    s = s
    parse = corenlp.raw_parse(s)
    sentences = []
    for l in parse['sentences']:
        sentence = []
        for w in l['words']:
            token = {}
            token['word'] = w[0]
            token['NER'] = w[1]['NamedEntityTag']
            token['POS'] = w[1]['PartOfSpeech']
            token['lemma'] = w[1]['Lemma']
            if token['POS'] == 'FW':
                token['lemma']=token['word']
            if token['word'] == '-LRB-':
                token['word'] = '('
            if token['word'] == '-RRB-':
                token['word'] = ')'
            token['WS'] = simp.getSynset(toString2(l['words']), token['word'])
            sentence.append(token)
        sentences.append(sentence)
    if 'coref' in parse:
        coref(parse['coref'],sentences)
    return sentences
Esempio n. 2
0
def getSynset(s,w):
    return simp.getSynset(s,w)

    '''wpos = ""