示例#1
0
def test_xpos_attribute():
    response = semgrex.process_doc(
        ONE_SENTENCE_DOC, "{tag:NNP}=source <=zzz {word:Opal}=target")
    check_response(response, response_len=1, source_index=2, reln='compound')
    response = semgrex.process_doc(
        ONE_SENTENCE_DOC, "{pos:NNP}=source <=zzz {word:Opal}=target")
    check_response(response, response_len=1, source_index=2, reln='compound')
示例#2
0
def test_ner_attribute():
    doc = Document(TEST_ONE_SENTENCE)
    response = semgrex.process_doc(
        doc, "{cpos:PROPN}=source <=zzz {ner:GEM}=target")
    check_response(response, response_len=1, source_index=2, reln='compound')
示例#3
0
def test_lemma_attribute():
    doc = Document(TEST_ONE_SENTENCE)
    response = semgrex.process_doc(
        doc, "{lemma:Mox}=source <=zzz {lemma:Opal}=target")
    check_response(response, response_len=1, source_index=2, reln='compound')
示例#4
0
def test_two_sentences():
    doc = Document(TEST_TWO_SENTENCES)
    response = semgrex.process_doc(doc, "{}=source >obj=zzz {}=target")
    check_response(response, response_len=2)
示例#5
0
def test_two_semgrex():
    doc = Document(TEST_ONE_SENTENCE)
    response = semgrex.process_doc(doc, "{}=source >obj=zzz {}=target",
                                   "{}=source >obj=zzz {}=target")
    check_response(response, semgrex_len=2)
示例#6
0
def test_single_sentence():
    doc = Document(TEST_ONE_SENTENCE)
    response = semgrex.process_doc(doc, "{}=source >obj=zzz {}=target")
    check_response(response)
示例#7
0
def test_lemma_attribute():
    response = semgrex.process_doc(
        ONE_SENTENCE_DOC, "{lemma:Mox}=source <=zzz {lemma:Opal}=target")
    check_response(response, response_len=1, source_index=2, reln='compound')
示例#8
0
def test_two_sentences():
    response = semgrex.process_doc(TWO_SENTENCE_DOC,
                                   "{}=source >obj=zzz {}=target")
    check_response(response, response_len=2)
示例#9
0
def test_two_semgrex():
    response = semgrex.process_doc(ONE_SENTENCE_DOC,
                                   "{}=source >obj=zzz {}=target",
                                   "{}=source >obj=zzz {}=target")
    check_response(response, semgrex_len=2)
示例#10
0
def test_single_sentence():
    response = semgrex.process_doc(ONE_SENTENCE_DOC,
                                   "{}=source >obj=zzz {}=target")
    check_response(response)