Created
February 6, 2012 03:02
-
-
Save louismullie/1749281 to your computer and use it in GitHub Desktop.
Treat - Coreference Extraction With Graph Colorization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'treat' | |
Treat.sweeten! | |
p = Paragraph "Obama and Sarkozy met on January 1st to investigate the possibility of a new rescue plan." + | |
"President Sarkozy is to meet Merkel next Tuesday in Berlin." | |
p.do( | |
:coreferences, | |
:visualize => [ | |
:dot, { | |
:file => 'ner-coref-extraction.dot', | |
:colors => { | |
:green => lambda do |entity| | |
entity.has?(:named_entity_tag) && | |
entity.named_entity_tag == :person | |
end, | |
:blue => lambda do |entity| | |
entity.has?(:named_entity_tag) && | |
entity.named_entity_tag == :date | |
end, | |
:red => lambda do |entity| | |
entity.has?(:named_entity_tag) && | |
entity.named_entity_tag == :location | |
end | |
} | |
} | |
] | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment