Skip to content

Instantly share code, notes, and snippets.

@hristo-vrigazov
Created January 5, 2017 13:05
Show Gist options
  • Save hristo-vrigazov/9c1c10e4334869cf33872db1b7a8dc45 to your computer and use it in GitHub Desktop.
Save hristo-vrigazov/9c1c10e4334869cf33872db1b7a8dc45 to your computer and use it in GitHub Desktop.
Word sense disambiguation using Problog
0.9::attribute_value(brown, brand).
0.9::attribute_value(brown, color).
0.9::attribute_value(tv, noun).
0.9::attribute_value(dress, clothing).
member(X, [Y|T]) :- X = Y; member(X, T).
item_prop(1, brown, brand).
item_prop(1, tv, noun).
item_prop(2, brown, color).
item_prop(2, dress, clothing).
0.8::disambiguate(Word, Attribute, Sentence) :-
member(Word, Sentence),
attribute_value(Word, Attribute),
member(AnotherWord, Sentence),
attribute_value(AnotherWord, AnotherWordAttribute),
item_prop(ItemNumber, Word, Attribute),
item_prop(ItemNumber, AnotherWord, AnotherWordAttribute).
query(disambiguate(brown, X, [brown, tv])).
query(disambiguate(brown, X, [brown, dress])).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment