Skip to content

Commit

Permalink
semtag logic improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
arysin committed Sep 23, 2024
1 parent 54e9745 commit bc8ee29
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/groovy/ua/net/nlp/tools/tag/SemTags.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public class SemTags {
if( posTag.contains("name") )
return semtag =~ ":hum|:supernat"
else
return semtag =~ ":hum|:supernat|:animal"
return semtag =~ ":hum|:supernat|:animal|:org"
}
else if( posTag.contains(":unanim") ) {
return semtag.contains(":animal")
Expand All @@ -140,7 +140,7 @@ public class SemTags {
return semtag.contains(":loc")
}

return ! (semtag =~ /:hum|:supernat|:animal/)
return semtag =~ /:hum:group/ || ! (semtag =~ /:hum|:supernat|:animal/)
}

return true
Expand Down
21 changes: 21 additions & 0 deletions src/test/groovy/ua/net/nlp/tools/tag/TagTextSemTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,27 @@ class TagTextSemTest {
TagResult tagged = tagText.tagText("Слово усе голова аахенська Вашингтон акту один-другий.")
assertEquals expected, tagged.tagged
}


@Test
public void testSemanticOrg() {
def expected=
"""<sentence>
<tokenReading>
<token value="хімвиробник" lemma="хімвиробник" tags="noun:anim:m:v_naz" semtags="1:conc:org" />
</tokenReading>
<tokenReading>
<token value="півча" lemma="півча" tags="noun:inanim:f:v_naz" semtags="1:conc:hum:group" />
<token value="півча" lemma="півчий" tags="adj:f:v_naz:bad" />
</tokenReading>
</sentence>
"""

tagText.setOptions(new TagOptions(semanticTags: true))
TagResult tagged = tagText.tagText("хімвиробник півча")
assertEquals expected, tagged.tagged
}



@Test
Expand Down

0 comments on commit bc8ee29

Please sign in to comment.