├── .gitignore
├── LICENSE
├── README.md
├── doc
├── allclasses-frame.html
├── allclasses-noframe.html
├── constant-values.html
├── deprecated-list.html
├── eu
│ └── newsreader
│ │ └── eventcoreference
│ │ ├── coref
│ │ ├── ChainCorefSets.html
│ │ ├── ComponentMatch.html
│ │ ├── DomainMatch.html
│ │ ├── GranularityMatch.html
│ │ ├── NormalizeScores.html
│ │ ├── PruneSets.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── evaluation
│ │ ├── EvaluateCorefs.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── input
│ │ ├── CorefSaxParser.html
│ │ ├── RdfReader.html
│ │ ├── SemDomParser.html
│ │ ├── SesameTrigReader.html
│ │ ├── TrigReader.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── naf
│ │ ├── ClusterEventObjects.html
│ │ ├── EntityCorefReferenceBaseline.html
│ │ ├── EventCorefLemmaBaseline.html
│ │ ├── GetSemFromNafFile.html
│ │ ├── GetSemFromNafStream.html
│ │ ├── InterDocumentEntityCoref.html
│ │ ├── InterDocumentEventCoref.html
│ │ ├── MatchEventObjects.html
│ │ ├── ResourcesUri.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── objects
│ │ ├── AgataMention.html
│ │ ├── CoRefSetAgata.html
│ │ ├── CompositeEvent.html
│ │ ├── CorefTargetAgata.html
│ │ ├── NafMention.html
│ │ ├── OwlTime.html
│ │ ├── PhraseCount.html
│ │ ├── Sem.html
│ │ ├── SemActor.html
│ │ ├── SemEvent.html
│ │ ├── SemObject.html
│ │ ├── SemPlace.html
│ │ ├── SemRelation.html
│ │ ├── SemTime.html
│ │ ├── SourceMeta.html
│ │ ├── Triple.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── ontology
│ │ ├── NodeData.html
│ │ ├── OwlReader.html
│ │ ├── RdfSense.html
│ │ ├── Tree.html
│ │ ├── TreeNode.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── output
│ │ ├── CombineCorefOutputPerEvent.html
│ │ ├── CorefSetToSem.html
│ │ ├── CorefTargetsInKafSentences.html
│ │ ├── CoreferenceBaseline.html
│ │ ├── DocumentToCorpusCoreferences.html
│ │ ├── FixSynsetReferences.html
│ │ ├── JenaSerialization.html
│ │ ├── MergeDocumentToCorpusCoreferencesByLemma.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ ├── pwn
│ │ ├── PwnSaxParser.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
│ │ └── util
│ │ ├── Anaphor.html
│ │ ├── EntityTypes.html
│ │ ├── EventTypes.html
│ │ ├── FilterCorefSets.html
│ │ ├── LabelCount.html
│ │ ├── ProcessNewsReaderCarBatch.html
│ │ ├── ProcessNewsReaderFolderBatch.html
│ │ ├── ProcessNewsReaderTechCrunchBatch.html
│ │ ├── ProcessSeparateNafFilesBatch.html
│ │ ├── ReadSourceMetaFile.html
│ │ ├── RoleLabels.html
│ │ ├── SemUtilObject.html
│ │ ├── SplitTechCrunch.html
│ │ ├── Statistics.TotalStats.html
│ │ ├── Statistics.html
│ │ ├── TimeLanguage.html
│ │ ├── Util.AppendableObjectOutputStream.html
│ │ ├── Util.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
├── help-doc.html
├── index-files
│ ├── index-1.html
│ ├── index-10.html
│ ├── index-11.html
│ ├── index-12.html
│ ├── index-13.html
│ ├── index-14.html
│ ├── index-15.html
│ ├── index-16.html
│ ├── index-17.html
│ ├── index-18.html
│ ├── index-19.html
│ ├── index-2.html
│ ├── index-20.html
│ ├── index-3.html
│ ├── index-4.html
│ ├── index-5.html
│ ├── index-6.html
│ ├── index-7.html
│ ├── index-8.html
│ └── index-9.html
├── index.html
├── overview-frame.html
├── overview-summary.html
├── overview-tree.html
├── package-list
├── resources
│ └── inherit.gif
├── serialized-form.html
└── stylesheet.css
├── install.sh
├── pom.xml
├── scripts
├── event-coreference-en.sh
├── event-coreference-lemma.sh
├── event-coreference-nl.sh
├── event-coreference-singleton.sh
├── jena-log4j.properties
├── naf-folder-to-simple-trig.sh
├── naf-folder-to-trig.sh
├── naf2sem-batch-cluster.sh
├── naf2sem-batch-nocluster.sh
├── naf2sem-grasp.sh
├── naf2sem-usage.sh
├── run_naf_folder.sh
├── run_phase1.sh
├── run_single_naf.sh
└── trigstatistics.sh
├── src
└── main
│ └── java
│ ├── META-INF
│ └── MANIFEST.MF
│ └── eu
│ └── newsreader
│ └── eventcoreference
│ ├── coref
│ ├── ChainCorefSets.java
│ ├── ComponentMatch.java
│ ├── Scoring.java
│ └── WithinDocumentEventCoref.java
│ ├── evaluation
│ └── EvaluateCorefs.java
│ ├── input
│ ├── CorefSaxParser.java
│ ├── EsoReader.java
│ ├── FrameNetReader.java
│ ├── GetEntityCounts.java
│ ├── GetEntityStats.java
│ ├── GetEsoCounts.java
│ ├── GetEventStats.java
│ ├── GetNAF.java
│ ├── NarrativeChains.java
│ ├── OwlReader.java
│ ├── OwlReader2.java
│ ├── RdfReader.java
│ ├── SelectEntityTrig.java
│ ├── SemDomParser.java
│ ├── SesameTrigReader.java
│ ├── TrigKSTripleReader.java
│ ├── TrigStatsReader.java
│ ├── TrigTripleData.java
│ ├── TrigTripleReader.java
│ └── TrigUtil.java
│ ├── naf
│ ├── ClusterEventObjects.java
│ ├── CreateMicrostory.java
│ ├── EntityCorefReferenceBaseline.java
│ ├── EventCorefLemmaBaseline.java
│ ├── EventCorefSingletonBaseline.java
│ ├── EventCorefWordnetSim.java
│ ├── GetJsonTimeLinesFromNaf.java
│ ├── GetPerspectiveRelations.java
│ ├── GetPerspectiveStatsFromNafFile.java
│ ├── GetSemFromCat.java
│ ├── GetSemFromNaf.java
│ ├── GetSemFromNafFile.java
│ ├── GetSemFromNafFolder.java
│ ├── GetSemFromNafStream.java
│ ├── GetSimpleSemFromNafFolder.java
│ ├── GetSimpleSemFromNafStream.java
│ ├── GetSimpleSemFromOldBaileyNafFolder.java
│ ├── GetTimeLinesFromNaf.java
│ ├── GetTimeLinesFromNafFolder.java
│ ├── MatchEventObjects.java
│ ├── NafSemParameters.java
│ ├── NoClusterEventObjects.java
│ ├── ParcAttributionTask.java
│ ├── ProcessEventObjectsStream.java
│ ├── ResourcesUri.java
│ └── StructuredEventObjects.java
│ ├── objects
│ ├── AgataMention.java
│ ├── CoRefSetAgata.java
│ ├── CompositeEvent.java
│ ├── CorefMatch.java
│ ├── CorefResultSet.java
│ ├── CorefTargetAgata.java
│ ├── CorefTriple.java
│ ├── JsonEvent.java
│ ├── NafMention.java
│ ├── OwlTime.java
│ ├── PerspectiveObject.java
│ ├── PhraseCount.java
│ ├── Sem.java
│ ├── SemActor.java
│ ├── SemEvent.java
│ ├── SemObject.java
│ ├── SemPlace.java
│ ├── SemRelation.java
│ ├── SemTime.java
│ ├── SourceMeta.java
│ ├── TimeTypes.java
│ └── Triple.java
│ ├── ontology
│ └── thesis
│ │ ├── NodeData.java
│ │ ├── OwlReader.java
│ │ ├── RdfSense.java
│ │ ├── Tree.java
│ │ └── TreeNode.java
│ ├── output
│ ├── CombineCorefOutputPerEvent.java
│ ├── CorefSetToSem.java
│ ├── CorefTargetsInKafSentences.java
│ ├── CoreferenceBaseline.java
│ ├── DataSetConceptHierarchy.java
│ ├── DataSetEntityHierarchy.java
│ ├── DataSetEventHierarchy.java
│ ├── DataSetSources.java
│ ├── DataSetTopicHierarchy.java
│ ├── DocumentToCorpusCoreferences.java
│ ├── FixSynsetReferences.java
│ ├── GetEventCentricGraph.java
│ ├── GetTypeHierarchyForConcepts.java
│ ├── JenaSerialization.java
│ ├── MergeDocumentToCorpusCoreferencesByLemma.java
│ ├── SimpleTaxonomy.java
│ ├── TrigStats.java
│ └── WriteStatementsKnowledgeStore.java
│ ├── pwn
│ ├── ILIReader.java
│ └── PwnSaxParser.java
│ ├── referencenet
│ ├── ReferenceAnnotation.java
│ ├── ReferenceNet.java
│ └── Util.java
│ ├── storyline
│ ├── JsonFromCat.java
│ ├── JsonFromRdf.java
│ ├── JsonSerialization.java
│ ├── JsonStoryUtil.java
│ ├── MentionResolver.java
│ ├── NafTokenLayerIndex.java
│ ├── PerspectiveJsonObject.java
│ ├── QueryKnowledgeStoreToJsonStoryPerspectives.java
│ ├── QueryKnowledgeStoreToJsonStoryPerspectivesOld.java
│ ├── ReadFtData.java
│ ├── TrigToJsonStoryPerspectives.java
│ └── TrigToJsonTimeLine.java
│ ├── timeline
│ └── EntityTimeLine.java
│ └── util
│ ├── Anaphor.java
│ ├── Clusterer.java
│ ├── CompareTrigFiles.java
│ ├── EntityTypes.java
│ ├── EuroVoc.java
│ ├── EventTypes.java
│ ├── FilterCorefSets.java
│ ├── FixUri.java
│ ├── FrameTypes.java
│ ├── LabelCount.java
│ ├── MD5Checksum.java
│ ├── MapEuroVocToEuroConcept.java
│ ├── PipelineOverview.java
│ ├── ProcessNewsReaderFolderBatch.java
│ ├── ProcessSeparateNafFilesBatch.java
│ ├── ReadSourceMetaFile.java
│ ├── RemoveEventCoreferences.java
│ ├── RoleLabels.java
│ ├── SemUtilObject.java
│ ├── SplitTechCrunch.java
│ ├── Statistics.java
│ ├── TimeLanguage.java
│ ├── TopicStatsFromTrig.java
│ ├── TreeStaticHtml.java
│ └── Util.java
└── usage
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 | .idea/
3 | /eventcoreference.properties
4 | /EventCoreference.ipr
5 | /eventcoreference.xml
6 | /.gitignore
7 | /EventCoreference.iws
8 | /EventCoreference.iml
9 | EventCoreference.iws
10 | EventCoreference.ipr
11 | eventcoreference.properties
12 | eventcoreference.xml
13 | module_eventcoreference.xml
14 | target/
15 | *.iml
16 | doc/EventCorefWordnetSimTest.html
17 | doc/eu/newsreader/eventcoreference/coref/Scoring.html
18 | doc/eu/newsreader/eventcoreference/input/EsoReader.html
19 | doc/eu/newsreader/eventcoreference/input/FrameNetReader.html
20 | doc/eu/newsreader/eventcoreference/input/GetEntityCounts.html
21 | doc/eu/newsreader/eventcoreference/input/GetEntityStats.html
22 | doc/eu/newsreader/eventcoreference/input/GetEsoCounts.html
23 | doc/eu/newsreader/eventcoreference/input/GetEventStats.html
24 | doc/eu/newsreader/eventcoreference/input/GetNAF.html
25 | doc/eu/newsreader/eventcoreference/input/NarrativeChains.html
26 | doc/eu/newsreader/eventcoreference/input/OwlReader.html
27 | doc/eu/newsreader/eventcoreference/input/OwlReader2.html
28 | doc/eu/newsreader/eventcoreference/input/SelectEntityTrig.html
29 | doc/eu/newsreader/eventcoreference/input/TrigKSTripleReader.html
30 | doc/eu/newsreader/eventcoreference/input/TrigStatsReader.html
31 | doc/eu/newsreader/eventcoreference/input/TrigTripleData.html
32 | doc/eu/newsreader/eventcoreference/input/TrigTripleReader.html
33 | doc/eu/newsreader/eventcoreference/input/TrigUtil.html
34 | doc/eu/newsreader/eventcoreference/naf/CreateMicrostory.html
35 | doc/eu/newsreader/eventcoreference/naf/EventCorefSingletonBaseline.html
36 | doc/eu/newsreader/eventcoreference/naf/EventCorefWordnetSim.html
37 | doc/eu/newsreader/eventcoreference/naf/GetJsonTimeLinesFromNaf.html
38 | doc/eu/newsreader/eventcoreference/naf/GetPerspectiveFromNafFile.html
39 | doc/eu/newsreader/eventcoreference/naf/GetPerspectiveRelations.html
40 | doc/eu/newsreader/eventcoreference/naf/GetPerspectiveStatsFromNafFile.PerspectiveStats.html
41 | doc/eu/newsreader/eventcoreference/naf/GetPerspectiveStatsFromNafFile.html
42 | doc/eu/newsreader/eventcoreference/naf/GetSemAndPerspectiveFromNafFile.html
43 | doc/eu/newsreader/eventcoreference/naf/GetSemFromNaf.html
44 | doc/eu/newsreader/eventcoreference/naf/GetSemFromNafFolder.html
45 | doc/eu/newsreader/eventcoreference/naf/GetTimeLinesFromNaf.html
46 | doc/eu/newsreader/eventcoreference/naf/GetTimeLinesFromNafFolder.html
47 | doc/eu/newsreader/eventcoreference/naf/Naf2SemTest.html
48 | doc/eu/newsreader/eventcoreference/naf/NafObjectToSemTest.html
49 | doc/eu/newsreader/eventcoreference/naf/NoClusterEventObjects.html
50 | doc/eu/newsreader/eventcoreference/naf/ParcAttributionTask.html
51 | doc/eu/newsreader/eventcoreference/naf/ProcessEventObjectsStream.html
52 | doc/eu/newsreader/eventcoreference/naf/RawTextIndex.html
53 | doc/eu/newsreader/eventcoreference/objects/CorefMatch.html
54 | doc/eu/newsreader/eventcoreference/objects/CorefResultSet.html
55 | doc/eu/newsreader/eventcoreference/objects/CorefTriple.html
56 | doc/eu/newsreader/eventcoreference/objects/JsonEvent.html
57 | doc/eu/newsreader/eventcoreference/objects/PerspectiveObject.html
58 | doc/eu/newsreader/eventcoreference/objects/PhraseCount.Compare.html
59 | doc/eu/newsreader/eventcoreference/objects/TimeTypes.html
60 | doc/eu/newsreader/eventcoreference/ontology/thesis/
61 | doc/eu/newsreader/eventcoreference/output/DataSetConceptHierarchy.html
62 | doc/eu/newsreader/eventcoreference/output/DataSetEntityHierarchy.html
63 | doc/eu/newsreader/eventcoreference/output/DataSetEventHierarchy.html
64 | doc/eu/newsreader/eventcoreference/output/DataSetSources.html
65 | doc/eu/newsreader/eventcoreference/output/DataSetTopicHierarchy.html
66 | doc/eu/newsreader/eventcoreference/output/GetEventCentricGraph.html
67 | doc/eu/newsreader/eventcoreference/output/GetTypeHierarchyForConcepts.html
68 | doc/eu/newsreader/eventcoreference/output/SimpleTaxonomy.html
69 | doc/eu/newsreader/eventcoreference/output/TrigStats.html
70 | doc/eu/newsreader/eventcoreference/pwn/ILIReader.html
71 | doc/eu/newsreader/eventcoreference/storyline/
72 | doc/eu/newsreader/eventcoreference/timeline/
73 | doc/eu/newsreader/eventcoreference/util/Clusterer.html
74 | doc/eu/newsreader/eventcoreference/util/CompareTrigFiles.html
75 | doc/eu/newsreader/eventcoreference/util/EuroVoc.html
76 | doc/eu/newsreader/eventcoreference/util/FixUri.html
77 | doc/eu/newsreader/eventcoreference/util/FrameTypes.html
78 | doc/eu/newsreader/eventcoreference/util/MapEuroVocToEuroConcept.html
79 | doc/eu/newsreader/eventcoreference/util/RemoveEventCoreferences.html
80 | doc/eu/newsreader/eventcoreference/util/TopicStatsFromTrig.html
81 | doc/eu/newsreader/eventcoreference/util/TreeStaticHtml.html
82 | doc/index-files/index-21.html
83 | doc/index-files/index-22.html
84 | doc/index-files/index-23.html
85 | doc/index-files/index-24.html
86 | doc/package-frame.html
87 | doc/package-summary.html
88 | doc/package-tree.html
89 | doc/script.js
90 | lib/
91 | src/main/java/eu/newsreader/eventcoreference/evaluation/.svn/
92 | src/main/java/eu/newsreader/eventcoreference/input/.svn/
93 | src/main/java/eu/newsreader/eventcoreference/objects/.svn/
94 | src/main/java/eu/newsreader/eventcoreference/output/.svn/
95 | src/main/java/eu/newsreader/eventcoreference/pwn/.svn/
96 | src/main/java/eu/newsreader/eventcoreference/util/.svn/
97 | src/main/resources/
98 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/coref/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.coref
7 |
8 |
9 |
10 |
11 |
12 |
13 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/coref/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.coref Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
87 |
88 |
89 |
90 |
91 |
108 |
109 |
110 | - Prev
111 | - Next
112 |
113 |
117 |
120 |
121 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/evaluation/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.evaluation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/evaluation/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.evaluation
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
74 |
75 |
76 | -
77 |
78 | Class Summary
79 |
80 | Class |
81 | Description |
82 |
83 |
84 |
85 | EvaluateCorefs |
86 |
87 | Created by IntelliJ IDEA.
88 | |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
113 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/evaluation/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.evaluation Class Hierarchy
7 |
8 |
9 |
10 |
11 |
12 |
22 |
25 |
26 |
43 |
70 |
71 |
78 |
79 |
Class Hierarchy
80 |
81 | - java.lang.Object
82 |
85 |
86 |
87 |
88 |
89 |
106 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/input/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.input
7 |
8 |
9 |
10 |
11 |
12 |
13 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/naf/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.naf
7 |
8 |
9 |
10 |
11 |
12 |
13 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/objects/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.objects
7 |
8 |
9 |
10 |
11 |
12 |
13 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/ontology/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | eu.newsreader.eventcoreference.ontology
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | eu.newsreader.eventcoreference.ontology
20 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/output/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.output
7 |
8 |
9 |
10 |
11 |
12 |
13 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/pwn/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.pwn
7 |
8 |
9 |
10 |
11 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/doc/eu/newsreader/eventcoreference/util/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | eu.newsreader.eventcoreference.util
7 |
8 |
9 |
10 |
11 |
12 |
13 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/doc/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Generated Documentation (Untitled)
7 |
59 |
60 |
74 |
75 |
--------------------------------------------------------------------------------
/doc/overview-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Overview List
7 |
8 |
9 |
10 |
11 |
12 |
13 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/doc/package-list:
--------------------------------------------------------------------------------
1 | eu.newsreader.eventcoreference.coref
2 | eu.newsreader.eventcoreference.evaluation
3 | eu.newsreader.eventcoreference.input
4 | eu.newsreader.eventcoreference.naf
5 | eu.newsreader.eventcoreference.objects
6 | eu.newsreader.eventcoreference.ontology.thesis
7 | eu.newsreader.eventcoreference.output
8 | eu.newsreader.eventcoreference.pwn
9 | eu.newsreader.eventcoreference.storyline
10 | eu.newsreader.eventcoreference.timeline
11 | eu.newsreader.eventcoreference.util
12 |
--------------------------------------------------------------------------------
/doc/resources/inherit.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cltl/EventCoreference/f1de443975dfde8c017b12ee4e93b3ad34ecb777/doc/resources/inherit.gif
--------------------------------------------------------------------------------
/doc/stylesheet.css:
--------------------------------------------------------------------------------
1 | /* Javadoc style sheet */
2 |
3 | /* Define colors, fonts and other style attributes here to override the defaults */
4 |
5 | /* Page background color */
6 | body { background-color: #FFFFFF; color:#000000 }
7 |
8 | /* Headings */
9 | h1 { font-size: 145% }
10 |
11 | /* Table colors */
12 | .TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */
13 | .TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */
14 | .TableRowColor { background: #FFFFFF; color:#000000 } /* White */
15 |
16 | /* Font used in left-hand frame lists */
17 | .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
18 | .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
19 | .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
20 |
21 | /* Navigation bar fonts and colors */
22 | .NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */
23 | .NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */
24 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;}
25 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;}
26 |
27 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
28 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
29 |
30 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | set -e
2 |
3 | #Requires an installation of maven 2.x and Java 1.6 or higher
4 |
5 | # define the location of the install scipt
6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7 | PARENT="$( cd $DIR && cd .. && pwd)"
8 |
9 | mkdir -p "$DIR/lib"
10 | echo "#1. compiling the library from source code and dependencies"
11 | mvn clean
12 | mvn install
13 | echo "#2. moving binary to lib folder"
14 | jarfile=`find $DIR/target -name "EventCoreference-v*-jar-with-dependencies.jar" -print`
15 | if
16 | [ "$jarfile" == "" ]
17 | then
18 | echo "could not generate the jar file. Sorry ..."
19 | exit 4
20 | fi
21 | mv $jarfile $DIR/lib
22 | echo "#3. installing the vua-resources"
23 | cd "$PARENT"
24 | if
25 | [ -d "vua-resources" ]
26 | then
27 | cd vua-resources
28 | git pull
29 | cd ..
30 | else
31 | git clone https://github.com/cltl/vua-resources.git
32 | fi
33 | echo "#4. cleaning up"
34 | cd "$DIR"
35 | rm -R target
36 | rm -R src
37 | rm EventCoreference.iml
38 | rm EventCoreference.iws
39 | rm EventCoreference.ipr
40 |
--------------------------------------------------------------------------------
/scripts/event-coreference-en.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 | ROOT="$( cd $DIR && cd .. && pwd)"
4 | LIB="$ROOT"/lib
5 | REL="has_hyperonym#event#has_hypernym"
6 |
7 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
8 | # assumes vua-resources is installed next to this installation
9 | # git clone https://github.com/cltl/vua-resources.git
10 |
11 | #pass naf file as input stream and catch the naf output stream
12 | # for example> "cat example-naf.xml | event-coreference.sh > example-naf.coref.xml"
13 |
14 | java -Xmx812m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.EventCorefWordnetSim --method leacock-chodorow --wn-lmf "$RESOURCES/wneng-30.lmf.xml.xpos.gz" --sim 2.0 --sim-ont 0.6 --wsd 0.8 --relations $REL --wn-prefix "eng" --source-frames "$RESOURCES/source.txt" --grammatical-frames "$RESOURCES/grammatical.txt" --contextual-frames "$RESOURCES/contextual.txt"
15 |
--------------------------------------------------------------------------------
/scripts/event-coreference-lemma.sh:
--------------------------------------------------------------------------------
1 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 | ROOT="$( cd $DIR && cd .. && pwd)"
3 | LIB="$ROOT"/lib
4 |
5 | #pass naf file as input stream and catch the naf output stream
6 | # for example> "cat example-naf.xml | event-coreference-lemma.sh > example-naf.coref.xml"
7 |
8 | java -Xmx812m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.EventCorefLemmaBaseline
9 |
10 |
--------------------------------------------------------------------------------
/scripts/event-coreference-nl.sh:
--------------------------------------------------------------------------------
1 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 | ROOT="$( cd $DIR && cd .. && pwd)"
3 | LIB="$ROOT"/lib
4 | REL="XPOS_NEAR_SYNONYM#HAS_HYPERONYM#HAS_XPOS_HYPERONYM#event"
5 |
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 | # assumes vua-resources is installed next to this installation
8 | # git clone https://github.com/cltl/vua-resources.git
9 |
10 | #pass naf file as input stream and catch the naf output stream
11 | # for example> "cat example-naf.xml | event-coreference.sh > example-naf.coref.xml"
12 |
13 | java -Xmx812m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.EventCorefWordnetSim --method leacock-chodorow --wn-lmf "$RESOURCES/odwn_orbn_gwg-LMF_1.3.xml.gz" --sim 2.0 --sim-ont 0.6 --wsd 0.8 --relations $REL --source-frames "$RESOURCES/source.txt" --grammatical-frames "$RESOURCES/grammatical.txt" --contextual-frames "$RESOURCES/contextual.txt"
14 |
--------------------------------------------------------------------------------
/scripts/event-coreference-singleton.sh:
--------------------------------------------------------------------------------
1 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 | ROOT="$( cd $DIR && cd .. && pwd)"
3 | LIB="$ROOT"/lib
4 |
5 | #pass naf file as input stream and catch the naf output stream
6 | # for example> "cat example-naf.xml | event-coreference-lemma.sh > example-naf.coref.xml"
7 |
8 | java -Xmx812m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.EventCorefSingletonBaseline
9 |
10 |
--------------------------------------------------------------------------------
/scripts/jena-log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=INFO, stdlog
2 | ## log4j.rootLogger=INFO, FusekiFileLog
3 |
4 | log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
5 | ## log4j.appender.stdlog.target=System.err
6 | log4j.appender.stdlog.layout=org.apache.log4j.PatternLayout
7 | log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-20c{1} :: %m%n
8 |
9 | ## # Example for file logging.
10 | ## log4j.appender.FusekiFileLog=org.apache.log4j.DailyRollingFileAppender
11 | ## log4j.appender.FusekiFileLog.DatePattern='.'yyyy-MM-dd
12 | ## log4j.appender.FusekiFileLog.File=fuseki-log
13 | ## log4j.appender.FusekiFileLog.layout=org.apache.log4j.PatternLayout
14 | ## log4j.appender.FusekiFileLog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-20c{1} :: %m%n
15 |
16 | # Jetty - Fuseki catches Jetty errors and reports them.
17 | log4j.logger.org.eclipse.jetty=FATAL
18 |
19 | # Execution logging
20 | log4j.logger.com.hp.hpl.jena.arq.info=INFO
21 | log4j.logger.com.hp.hpl.jena.arq.exec=INFO
22 |
23 | # TDB loader
24 | log4j.logger.com.hp.hpl.jena.tdb.loader=INFO
25 | # TDB syslog.
26 | log4j.logger.TDB=INFO
27 |
28 | # Everything else in Jena
29 | log4j.logger.com.hp.hpl.jena=WARN
30 | log4j.logger.org.openjena=WARN
31 | log4j.logger.org.openjena.riot=INFO
32 |
33 | # Fuseki
34 | # Server log.
35 | log4j.logger.org.openjena.fuseki.Server=INFO
36 | # Request log.
37 | log4j.logger.org.openjena.fuseki.Fuseki=INFO
38 | # Internal logs
39 | log4j.logger.org.openjena.fuseki=INFO
40 |
--------------------------------------------------------------------------------
/scripts/naf-folder-to-simple-trig.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 | ROOT="$( cd $DIR && cd .. && pwd)"
4 | LIB="$ROOT"/lib
5 |
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 | # assumes vua-resources is installed next to this installation
8 | # git clone https://github.com/cltl/vua-resources.git
9 | #
10 | # the software assume that the input files are in NAF format minially with the following layers:
11 | # - tokens, terms, entities, coreference for events, srl, timeExpressions
12 | # to create an event coreference layer, use the event-coreference scripts
13 |
14 | #DUTCH
15 | ontology ="$RESOURCES"/dbpedia_nl_types.tsv.gz
16 | #ENGLISH
17 | ontology ="$RESOURCES"/instance_types_en.ttl.gz
18 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.GetSimpleSemFromNafFolder --naf-folder $1 --extension ".naf" --ontology $ontology
19 |
--------------------------------------------------------------------------------
/scripts/naf-folder-to-trig.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 | ROOT="$( cd $DIR && cd .. && pwd)"
4 | LIB="$ROOT"/lib
5 |
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 | # assumes vua-resources is installed next to this installation
8 | # git clone https://github.com/cltl/vua-resources.git
9 | #
10 | # the software assume that the input files are in NAF format minially with the following layers:
11 | # - tokens, terms, entities, coreference for events, srl, timeExpressions
12 | # to create an event coreference layer, use the event-coreference scripts
13 |
14 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.GetSemFromNafFolder --naf-folder $1 --extension ".naf" --non-entities --project wikinews --all --ili "$RESOURCES/ili.ttl.gz" --perspective --eurovoc-en "$RESOURCES/mapping_eurovoc_skos.label.concept.gz" --source-frames "$RESOURCES/source.txt"
15 |
--------------------------------------------------------------------------------
/scripts/naf2sem-batch-cluster.sh:
--------------------------------------------------------------------------------
1 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 | ROOT="$( cd $DIR && cd .. && pwd)"
3 | LIB="$ROOT"/lib
4 | EVENTS="$1"
5 | PROJECT="$2"
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 | # assumes vua-resources is installed next to this installation
8 | # git clone https://github.com/cltl/vua-resources.git
9 | # the software assume that the input files are in NAF format minially with the following layers:
10 | # - tokens, terms, entities, coreference for events, srl, timeExpressions
11 | # to create an event coreference layer, use the event-coreference scripts
12 |
13 |
14 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.ClusterEventObjects --naf-folder "$EVENTS" --event-folder "$EVENTS" --extension ".xml" --non-entities --project "$PROJECT" --all --eurovoc-en "$RESOURCES/mapping_eurovoc_skos.csv.gz" --source-frames "$RESOURCES/source.txt" --grammatical-frames "$RESOURCES/grammatical.txt" --contextual-frames "$RESOURCES/contextual.txt"
15 |
16 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.MatchEventObjects --event-folder "$EVENTS/events/contextualEvent" --match-type ililemma --roles "anyrole" --concept-match 30 --phrase-match 30 --hypers --lcs --ili "$RESOURCES//ili.ttl.gz"
17 |
18 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.MatchEventObjects --event-folder "$EVENTS/events/sourceEvent" --match-type ililemma --roles "a0" --concept-match 30 --phrase-match 30 --ili "$RESOURCES//ili.ttl.gz"
19 |
20 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.MatchEventObjects --event-folder "$EVENTS/events/grammaticalEvent" --match-type lemma --roles "a1" --phrase-match 30 --ili "$RESOURCES/ili.ttl.gz"
21 |
22 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.MatchEventObjects --event-folder "$EVENTS/events/futureEvent" --match-type lemma --roles "all" --phrase-match 30 --ili "$RESOURCES/ili.ttl.gz"
23 |
--------------------------------------------------------------------------------
/scripts/naf2sem-batch-nocluster.sh:
--------------------------------------------------------------------------------
1 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2 | ROOT="$( cd $DIR && cd .. && pwd)"
3 | LIB="$ROOT"/lib
4 | EVENTS="$1"
5 | PROJECT="$2"
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 | # assumes vua-resources is installed next to this installation
8 | # git clone https://github.com/cltl/vua-resources.git
9 | # the software assume that the input files are in NAF format minially with the following layers:
10 | # - tokens, terms, entities, coreference for events, srl, timeExpressions
11 | # to create an event coreference layer, use the event-coreference scripts
12 |
13 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.NoClusterEventObjects --naf-folder "$EVENTS" --event-folder "$EVENTS" --extension ".xml" --non-entities --project "$PROJECT" --all --eurovoc-en "$RESOURCES/mapping_eurovoc_skos.csv.gz"
14 |
15 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.MatchEventObjects --event-folder "$EVENTS" --match-type ililemma --roles "anyrole" --concept-match 30 --phrase-match 30 --ili "$RESOURCES/ili.ttl.gz" --hypers --lcs
16 |
17 |
--------------------------------------------------------------------------------
/scripts/naf2sem-grasp.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 | ROOT="$( cd $DIR && cd .. && pwd)"
4 | LIB="$ROOT"/lib
5 |
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 | # assumes vua-resources is installed next to this installation
8 | # git clone https://github.com/cltl/vua-resources.git
9 | #
10 | # the software assume that the input files are in NAF format minially with the following layers:
11 | # - tokens, terms, entities, coreference for events, srl, timeExpressions
12 | # to create an event coreference layer, use the event-coreference scripts
13 |
14 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.GetSemFromNafStream --non-entities --project test --all --ili "$RESOURCES/ili.ttl.gz" --perspective --eurovoc-en "$RESOURCES/mapping_eurovoc_skos.label.concept.gz" --source-frames "$RESOURCES/source.txt"
15 |
--------------------------------------------------------------------------------
/scripts/naf2sem-usage.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 | ROOT="$( cd $DIR && cd .. && pwd)"
4 | LIB="$ROOT"/lib
5 |
6 |
7 |
8 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.naf.NafSemParameters
9 |
--------------------------------------------------------------------------------
/scripts/run_naf_folder.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | extensions=(naf)
4 |
5 | for ext in "${extensions[@]}"
6 | do
7 | echo "Look for files with extension: $ext"
8 | if [ -e ../nafs_to_process/*.$ext ]; then
9 | echo "Files with extension $ext exist. Now processing them ..."
10 | for f in ../nafs_to_process/*.$ext ;
11 | do
12 | base=$(basename $f)
13 | echo "File: $base"
14 | cat $f | java -Xmx2000m -cp ../target/EventCoreference-v3.1.2-jar-with-dependencies.jar eu.newsreader.eventcoreference.naf.GetSemFromNafStream --project cars --source-frames "../resources/source.txt" --grammatical-frames "../resources/grammatical.txt" --contextual-frames "../resources/contextual.txt" --non-entities --timex-max 5 --ili ../resources/ili.ttl | java -Xmx2000m -cp ../target/EventCoreference-1.0-SNAPSHOT-jar-with-dependencies.jar eu.newsreader.eventcoreference.naf.ProcessEventObjectsStream --source-roles "pb\:A0,pb\:A1" --contextual-match-type "LEMMA" > "../trigs/$base.trig"
15 | echo "Trig created. Now inserting into the KS"
16 | wget -O /dev/null --post-file "../trigs/$base.trig" --header 'Content-type: application/x-trig' https://knowledgestore2.fbk.eu/nwr/aitor/custom/naf2sem
17 |
18 | if [ $? -ne 0 ]; then
19 | echo "Error occurred while inserting into the KS. Please review the naf and the trig files..."
20 | else
21 | echo "Insertion done"
22 | mv $f ../nafs_processed/
23 | fi
24 |
25 | done
26 | else
27 | echo "No files with extension $ext exist in the directory ../nafs_to_process! "
28 | fi
29 | done
30 |
--------------------------------------------------------------------------------
/scripts/run_phase1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | extensions=(naf)
4 |
5 | for ext in "${extensions[@]}"
6 | do
7 | echo "Look for files with extension: $ext"
8 | if [ -e ../nafs_to_process/*.$ext ]; then
9 | echo "Files with extension $ext exist. Now processing them ..."
10 | for f in ../nafs_to_process/*.$ext ;
11 | do
12 | base=$(basename $f)
13 | echo "File: $base"
14 | cat $f | java -Xmx2000m -cp ../target/EventCoreference-v3.1.2-jar-with-dependencies.jar eu.newsreader.eventcoreference.naf.GetSemFromNafStream --project cars --source-frames "../resources/source.txt" --grammatical-frames "../resources/grammatical.txt" --contextual-frames "../resources/contextual.txt" --non-entities --timex-max 5 --ili ../resources/ili.ttl > ../phase1.trig
15 | echo "Trig created. Now inserting into the KS"
16 | #wget -O /dev/null --post-file "../trigs/$base.trig" --header 'Content-type: application/x-trig' https://knowledgestore2.fbk.eu/nwr/aitor/custom/naf2sem
17 | #echo "Insertion done"
18 | # mv $f ../nafs_processed/
19 | done
20 | else
21 | echo "No files with extension $ext exist in the directory ../nafs_to_process! "
22 | fi
23 | done
24 |
--------------------------------------------------------------------------------
/scripts/run_single_naf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | f="$1"
4 |
5 | if [ -z $1 ]; then
6 | echo "Please specify a file. Exiting now..."
7 | exit
8 | fi
9 |
10 | base=$(basename $f)
11 | echo "File to process: $base"
12 | cat $f | java -Xmx2000m -cp ../target/EventCoreference-v3.1.2-jar-with-dependencies.jar eu.newsreader.eventcoreference.naf.GetSemFromNafStream --project end-to-end --source-frames "../resources/source.txt" --grammatical-frames "../resources/grammatical.txt" --contextual-frames "../resources/contextual.txt" --non-entities --perspective --ili ../resources/ili.ttl.gz --eurovoc-en "../resources/mapping_eurovoc_skos.csv" | java -Xmx2000m -cp ../target/EventCoreference-3.0-jar-with-dependencies.jar eu.newsreader.eventcoreference.naf.ProcessEventObjectsStream --source-roles "pb\:A0,pb\:A1" --contextual-match-type "ILILEMMA" --ks https://myknowledgestore --user me --passw mypassw > "../trigs/$base.trig"
13 |
14 | echo "Trig created. Now inserting into the KS"
15 | wget -O /dev/null --post-file "../trigs/$base.trig" --header 'Content-type: application/x-trig' https://knowledgestore2.fbk.eu/nwr/aitor/custom/naf2sem
16 | if [ $? -ne 0 ]; then
17 | echo "Error occurred while inserting into the KS. Please review the naf and the trig files..."
18 | else
19 | echo "Insertion done"
20 | mv $f ../nafs_processed/
21 | fi
22 |
--------------------------------------------------------------------------------
/scripts/trigstatistics.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 | ROOT="$( cd $DIR && cd .. && pwd)"
4 | LIB="$ROOT"/target
5 |
6 | RESOURCES="$( cd $ROOT && cd .. && pwd)"/vua-resources
7 |
8 | PATH_TO_TRIG=$1
9 | TYPE="instance"
10 | # instance or grasp
11 |
12 | #STAT=
13 | # can be empty (dumps all) or "en=entities", "ne=non-entities", "dbp=dbpedia" , "event" or "topic"
14 |
15 | # limit the freqquency
16 | N="0"
17 |
18 | java -Xmx2000m -cp "$LIB/EventCoreference-v3.1.2-jar-with-dependencies.jar" eu.newsreader.eventcoreference.output.TrigStats --trig-folder $PATH_TO_TRIG --type $TYPE --n $N
19 | #--stat $STAT
20 |
21 |
--------------------------------------------------------------------------------
/src/main/java/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: eu.newsreader.eventcoreference.naf.GetSemFromNafStream
3 |
4 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/coref/ChainCorefSets.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.coref;
2 |
3 | import eu.newsreader.eventcoreference.objects.CorefMatch;
4 | import eu.newsreader.eventcoreference.objects.CorefResultSet;
5 |
6 | import java.util.ArrayList;
7 |
8 | /**
9 | * Created with IntelliJ IDEA.
10 | * User: kyoto
11 | * Date: 2/17/13
12 | * Time: 6:12 PM
13 | * To change this template use File | Settings | File Templates.
14 | */
15 | public class ChainCorefSets {
16 |
17 | static public ArrayList chainResultSets (ArrayList corefMatchList) {
18 | ArrayList condensedSets = new ArrayList();
19 | for (int i = 0; i < corefMatchList.size(); i++) {
20 | CorefResultSet candidateCorefResultSet = corefMatchList.get(i);
21 | boolean CHAINIT = false;
22 | for (int j = 0; j < condensedSets.size(); j++) {
23 | CorefResultSet coreferenceSet = condensedSets.get(j);
24 | /// do we need to do something with the sources???????
25 | /* if (coreferenceSet.hasSpanAndLowestCommonSubsumer(corefMatch)) {
26 | //if (coreferenceSet.hasSpan(corefMatch.getCorefTargets())) {
27 | //// there is a match so start adding the corefResultSet to the KafCoreferenceSet
28 | CHAINIT = true;
29 | break;
30 | }
31 | else {
32 | //if span matches but not the lcs we need to choose one of the other
33 | }*/
34 | for (int k = 0; k < candidateCorefResultSet.getTargets().size(); k++) {
35 | CorefMatch corefMatch = candidateCorefResultSet.getTargets().get(k);
36 | if (coreferenceSet.hasSpanAndLowestCommonSubsumer(corefMatch)) {
37 | //if (coreferenceSet.hasSpan(corefMatch.getCorefTargets())) {
38 | //// there is a match so start adding the corefResultSet to the KafCoreferenceSet
39 | CHAINIT = true;
40 | break;
41 | }
42 | else {
43 | //if span matches but not the lcs we need to choose one of the other
44 | }
45 | }
46 | if (CHAINIT) {
47 | for (int k = 0; k < candidateCorefResultSet.getTargets().size(); k++) {
48 | CorefMatch corefMatch = candidateCorefResultSet.getTargets().get(k);
49 | coreferenceSet.addTargetScore(corefMatch);
50 | }
51 | // coreferenceSet.addSourceCoref(candidateCorefResultSet.getSources());
52 | /// we are done with this set and can break the loop
53 | break;
54 | }
55 | }
56 | if (!CHAINIT) {
57 | condensedSets.add(candidateCorefResultSet);
58 | }
59 | }
60 | return condensedSets;
61 | }
62 |
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/coref/Scoring.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.coref;
2 |
3 | import eu.newsreader.eventcoreference.objects.CorefMatch;
4 |
5 | import java.util.ArrayList;
6 |
7 | /**
8 | * Created by piek on 10/13/14.
9 | */
10 | public class Scoring {
11 | static public ArrayList pruneCoref (ArrayList corefsets, int threshold) {
12 | ArrayList newCorefMatches = new ArrayList();
13 | for (int i = 0; i < corefsets.size(); i++) {
14 | CorefMatch corefMatch = corefsets.get(i);
15 | if (corefMatch.getScore()*100>=threshold) {
16 | newCorefMatches.add(corefMatch);
17 | }
18 | else {
19 | // System.out.println("removing corefMatch = " + corefMatch.getScore());
20 | }
21 | }
22 | return newCorefMatches;
23 | }
24 |
25 | static public void normalizeCorefMatch (ArrayList coRefSets) {
26 | double maxScore = 0;
27 | double minScore = 0;
28 | for (int c = 0; c < coRefSets.size(); c++) {
29 | CorefMatch corefMatch = coRefSets.get(c);
30 | double corefScore = corefMatch.getScore();
31 | if (corefScore>maxScore) {
32 | maxScore = corefScore;
33 | }
34 | else if (corefScore(i+1)) {
33 | user = args[i+1];
34 | }
35 | else if (arg.equalsIgnoreCase("--p") && args.length>(i+1)) {
36 | pass = args[i+1];
37 | }
38 | }
39 | Authenticator.setDefault(new Authenticator() {
40 |
41 | @Override
42 | protected PasswordAuthentication getPasswordAuthentication() {
43 | return new PasswordAuthentication(user, pass.toCharArray());
44 | }
45 | });
46 |
47 |
48 | System.out.println(getFile("https://knowledgestore2.fbk.eu/nwr/cars3/files?id=%3Chttp%3A%2F%2Fwww.newsreader-project.eu%2Fdata%2Fcars%2F2004%2F10%2F18%2F4DKT-30W0-00S0-W39B.xml.naf%3E"));
49 | long estimatedTime = System.currentTimeMillis() - startTime;
50 | System.out.println("Time elapsed:");
51 | System.out.println(estimatedTime/1000.0);
52 | }
53 |
54 | public static String getFile(String stringUrl) throws Exception {
55 | //stringUrl = "https://knowledgestore2.fbk.eu/nwr/cars3/files?id=%3Chttp%3A%2F%2Fwww.newsreader-project.eu%2Fdata%2Fcars%2F2004%2F10%2F18%2F4DKT-30W0-00S0-W39B.xml.naf%3E";
56 |
57 | URL url = new URL(stringUrl);
58 | HttpURLConnection connection =
59 | (HttpURLConnection) url.openConnection();
60 | connection.setRequestMethod("GET");
61 | // connection.setRequestProperty("Accept", "application/xml");
62 | connection.setRequestProperty("Accept", "application/octet-stream");
63 | InputStream xml = connection.getInputStream();
64 | KafSaxParser kafSaxParser = new KafSaxParser();
65 | kafSaxParser.parseFile(xml);
66 | String rawText = kafSaxParser.rawText;
67 | /* DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
68 | DocumentBuilder db = dbf.newDocumentBuilder();
69 | Document doc = db.parse(xml);
70 | return getStringFromDocument(doc);*/
71 | return rawText;
72 | }
73 |
74 | public static ArrayList getNafWordFormsFile(String stringUrl) throws Exception {
75 | //stringUrl = "https://knowledgestore2.fbk.eu/nwr/cars3/files?id=%3Chttp%3A%2F%2Fwww.newsreader-project.eu%2Fdata%2Fcars%2F2004%2F10%2F18%2F4DKT-30W0-00S0-W39B.xml.naf%3E";
76 | KafSaxParser kafSaxParser = new KafSaxParser();
77 |
78 | URL url = new URL(stringUrl);
79 | HttpURLConnection connection =
80 | (HttpURLConnection) url.openConnection();
81 | connection.setRequestMethod("GET");
82 | // connection.setRequestProperty("Accept", "application/xml");
83 | /* connection.setRequestProperty("Accept", "application/octet-stream");
84 | InputStream xml = connection.getInputStream();
85 | kafSaxParser.parseFile(xml);*/
86 |
87 | connection.setRequestProperty("Accept-Encoding", "gzip"); /// gets gzipped NAF
88 | InputStream xml = connection.getInputStream();
89 | InputStream gzipStream = new GZIPInputStream(xml);
90 | kafSaxParser.parseFile(gzipStream);
91 | System.out.println(gzipStream);
92 | return kafSaxParser.kafWordFormList;
93 | }
94 |
95 | public static String getText(String stringUrl) throws Exception {
96 | //stringUrl = "https://knowledgestore2.fbk.eu/nwr/cars3/files?id=%3Chttp%3A%2F%2Fwww.newsreader-project.eu%2Fdata%2Fcars%2F2004%2F10%2F18%2F4DKT-30W0-00S0-W39B.xml.naf%3E";
97 |
98 | URL url = new URL(stringUrl);
99 | HttpURLConnection connection =
100 | (HttpURLConnection) url.openConnection();
101 | connection.setRequestMethod("GET");
102 | // connection.setRequestProperty("Accept", "application/xml");
103 | connection.setRequestProperty("Accept", "application/octet-stream");
104 | InputStream xml = connection.getInputStream();
105 | String rawText = xml.toString();
106 | return rawText;
107 | }
108 |
109 |
110 | public static String getStringFromDocument(Document doc) throws TransformerException {
111 | DOMSource domSource = new DOMSource(doc);
112 | StringWriter writer = new StringWriter();
113 | StreamResult result = new StreamResult(writer);
114 | TransformerFactory tf = TransformerFactory.newInstance();
115 | Transformer transformer = tf.newTransformer();
116 | transformer.transform(domSource, result);
117 | return writer.toString();
118 | }
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/input/NarrativeChains.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.input;
2 |
3 | import java.io.*;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 |
7 | /**
8 | * Created by piek on 09/05/15.
9 | */
10 | public class NarrativeChains {
11 | //Events: sell buy own acquire operate purchase spin_off build plan pay merge announce
12 |
13 | public HashMap> chainMap;
14 | public HashMap> verbMap;
15 |
16 | public NarrativeChains (String chainFilePath) {
17 | chainMap = new HashMap>();
18 | verbMap = new HashMap>();
19 | if (new File(chainFilePath).exists() ) {
20 | try {
21 | FileInputStream fis = new FileInputStream(chainFilePath);
22 | InputStreamReader isr = new InputStreamReader(fis);
23 | BufferedReader in = new BufferedReader(isr);
24 | String inputLine;
25 | Integer chainId = 0;
26 | while (in.ready()&&(inputLine = in.readLine()) != null) {
27 | //System.out.println(inputLine);
28 | if (inputLine.trim().startsWith("Events:")) {
29 | chainId++;
30 | ArrayList verbsArrayList = new ArrayList();
31 | String [] verbs = inputLine.split(" ");
32 | for (int i = 1; i < verbs.length; i++) { /// skipping Events:
33 | String verb = verbs[i];
34 | verbsArrayList.add(verb);
35 | if (chainMap.containsKey(verb)) {
36 | ArrayList chains = chainMap.get(verb);
37 | chains.add(chainId);
38 | chainMap.put(verb, chains);
39 | }
40 | else {
41 | ArrayList chains = new ArrayList();
42 | chains.add(chainId);
43 | chainMap.put(verb, chains);
44 | }
45 | }
46 | verbMap.put(chainId, verbsArrayList);
47 | }
48 | }
49 | in.close();
50 | } catch (IOException e) {
51 | e.printStackTrace();
52 | }
53 | }
54 | }
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/input/OwlReader.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.input;
2 |
3 | import com.hp.hpl.jena.ontology.OntClass;
4 | import com.hp.hpl.jena.ontology.OntModel;
5 | import com.hp.hpl.jena.ontology.OntModelSpec;
6 | import com.hp.hpl.jena.query.QueryExecution;
7 | import com.hp.hpl.jena.query.QueryExecutionFactory;
8 | import com.hp.hpl.jena.query.QuerySolution;
9 | import com.hp.hpl.jena.query.ResultSet;
10 | import com.hp.hpl.jena.rdf.model.ModelFactory;
11 | import com.hp.hpl.jena.rdf.model.Resource;
12 | import com.hp.hpl.jena.util.iterator.Filter;
13 | import eu.newsreader.eventcoreference.naf.ResourcesUri;
14 |
15 | import java.util.Iterator;
16 |
17 | /**
18 | * Created by piek on 10/5/14.
19 | */
20 | public class OwlReader {
21 |
22 |
23 | static public String createSparql(String variable, String typeUri) {
24 | String q = "SELECT ?"+variable+" " +
25 | "WHERE{" +
26 | "?"+variable+" a "+typeUri +
27 | "}";
28 | return q;
29 | }
30 |
31 | static public String createSparqlTriple(String variable, String subj, String pred, String obj) {
32 | String q = "SELECT ?"+variable+" \n" +
33 | "WHERE { " +
34 | " "+subj+ " \n"+
35 | " "+pred+ " \n"+
36 | " "+obj+
37 | "}";
38 | return q;
39 | }
40 |
41 | static void readOwlFile (String pathToOwlFile) {
42 | OntModel ontologyModel =
43 | ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
44 | ontologyModel.read(pathToOwlFile, "RDF/XML-ABBREV");
45 | // OntClass myClass = ontologyModel.getOntClass("namespace+className");
46 |
47 | OntClass myClass = ontologyModel.getOntClass(ResourcesUri.nwr+"domain-ontology#Motion");
48 | System.out.println("myClass.toString() = " + myClass.toString());
49 | System.out.println("myClass.getSuperClass().toString() = " + myClass.getSuperClass().toString());
50 |
51 | //List list =
52 | // namedHierarchyRoots(ontologyModel);
53 |
54 |
55 | Iterator i = ontologyModel.listHierarchyRootClasses()
56 | .filterDrop( new Filter() {
57 | public boolean accept( Object o ) {
58 | return ((Resource) o).isAnon();
59 | }} ); ///get all top nodes and excludes anonymous classes
60 |
61 | // Iterator i = ontologyModel.listHierarchyRootClasses();
62 | while (i.hasNext()) {
63 | System.out.println(i.next().toString());
64 | /* OntClass ontClass = ontologyModel.getOntClass(i.next().toString());
65 | if (ontClass.hasSubClass()) {
66 |
67 | }*/
68 | }
69 |
70 | String q = createSparql("event", "");
71 | System.out.println("q = " + q);
72 | QueryExecution qe = QueryExecutionFactory.create(q,
73 | ontologyModel);
74 | for (ResultSet rs = qe.execSelect() ; rs.hasNext() ; ) {
75 | QuerySolution binding = rs.nextSolution();
76 | System.out.println("binding = " + binding.toString());
77 | System.out.println("Event: " + binding.get("event"));
78 | }
79 |
80 | ontologyModel.close();
81 | }
82 |
83 | static public void main (String [] args) {
84 | String pathToOwlOntology = "/Users/piek/Desktop/NWR/NWR-ontology/version-0.6/ESO_version_0.6.owl";
85 | readOwlFile (pathToOwlOntology);
86 |
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/input/OwlReader2.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.input;
2 |
3 |
4 | import org.semanticweb.owlapi.apibinding.OWLManager;
5 | import org.semanticweb.owlapi.model.*;
6 | import org.semanticweb.owlapi.reasoner.OWLReasoner;
7 | import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
8 |
9 | import java.io.PrintStream;
10 |
11 | //import javax.annotation.Nonnull;
12 |
13 | /**
14 | * Created by piek on 10/5/14.
15 | */
16 | @SuppressWarnings("javadoc")
17 |
18 |
19 | public class OwlReader2 {
20 |
21 |
22 | private static final int INDENT = 4;
23 | // @Nonnull
24 | private final OWLReasonerFactory reasonerFactory;
25 | // @Nonnull
26 | private final OWLOntology ontology;
27 | private final PrintStream out;
28 |
29 | private OwlReader2(OWLReasonerFactory reasonerFactory,
30 | OWLOntology inputOntology) {
31 | this.reasonerFactory = reasonerFactory;
32 | ontology = inputOntology;
33 | out = System.out;
34 | }
35 |
36 | /**
37 | * Print the class hierarchy for the given ontology from this class down,
38 | * assuming this class is at the given level. Makes no attempt to deal
39 | * sensibly with multiple inheritance.
40 | */
41 | private void printHierarchy(OWLClass clazz) throws OWLException {
42 | OWLReasoner reasoner = reasonerFactory
43 | .createNonBufferingReasoner(ontology);
44 | printHierarchy(reasoner, clazz, 0);
45 | /* Now print out any unsatisfiable classes */
46 | for (OWLClass cl : ontology.getClassesInSignature()) {
47 | assert cl != null;
48 | if (!reasoner.isSatisfiable(cl)) {
49 | out.println("XXX: " + labelFor(cl));
50 | }
51 | }
52 | reasoner.dispose();
53 | }
54 |
55 | private String labelFor(OWLClass clazz) {
56 | /*
57 | * Use a visitor to extract label annotations
58 | */
59 | /*LabelExtractor le = new LabelExtractor();
60 | for (OWLAnnotation anno : annotations(ontology
61 | .getAnnotationAssertionAxioms(clazz.getIRI()))) {
62 | anno.accept(le);
63 | }
64 | *//* Print out the label if there is one. If not, just use the class URI *//*
65 | if (le.getResult() != null) {
66 | return le.getResult();
67 | } else {
68 | return clazz.getIRI().toString();
69 | }*/
70 | return "";
71 | }
72 |
73 | /**
74 | * Print the class hierarchy from this class down, assuming this class is at
75 | * the given level. Makes no attempt to deal sensibly with multiple
76 | * inheritance.
77 | */
78 | private void printHierarchy(OWLReasoner reasoner,
79 | OWLClass clazz, int level) throws OWLException {
80 | /*
81 | * Only print satisfiable classes -- otherwise we end up with bottom
82 | * everywhere
83 | */
84 | if (reasoner.isSatisfiable(clazz)) {
85 | for (int i = 0; i < level * INDENT; i++) {
86 | out.print(" ");
87 | }
88 | out.println(labelFor(clazz));
89 | /* Find the children and recurse */
90 | for (OWLClass child : reasoner.getSubClasses(clazz, true)
91 | .getFlattened()) {
92 | if (!child.equals(clazz)) {
93 | printHierarchy(reasoner, child, level + 1);
94 | }
95 | }
96 | }
97 | }
98 |
99 | static public void main (String[] args) throws OWLException,
100 | InstantiationException, IllegalAccessException,
101 | ClassNotFoundException {
102 | String reasonerFactoryClassName = null;
103 |
104 | String pathToOwlOntology = "/Users/piek/Desktop/NWR/NWR-ontology/version-0.6/ESO_version_0.6.owl";
105 | OWLOntologyManager m = (OWLOntologyManager) OWLManager.getOWLDataFactory();
106 | @SuppressWarnings("null")
107 | //@Nonnull
108 | IRI documentIRI = IRI.create(pathToOwlOntology);
109 | OWLOntology ontology = m
110 | .loadOntologyFromOntologyDocument(documentIRI);
111 | // Report information about the ontology
112 | System.out.println("Ontology Loaded...");
113 | System.out.println("Document IRI: " + documentIRI);
114 | System.out.println("Ontology : " + ontology.getOntologyID());
115 | System.out.println("Format : "
116 | + m.getOntologyFormat(ontology));
117 |
118 | @SuppressWarnings("null")
119 |
120 | OwlReader2 simpleHierarchy = new OwlReader2(
121 | (OWLReasonerFactory) Class.forName(reasonerFactoryClassName)
122 | .newInstance(), ontology);
123 | // Get Thing
124 | OWLClass clazz = m.getOWLDataFactory().getOWLThing();
125 | System.out.println("Class : " + clazz);
126 | // Print the hierarchy below thing
127 | simpleHierarchy.printHierarchy(clazz);
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/input/RdfReader.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.input;
2 |
3 | import com.hp.hpl.jena.rdf.model.Model;
4 | import com.hp.hpl.jena.rdf.model.ModelFactory;
5 | import com.hp.hpl.jena.util.FileManager;
6 |
7 | import java.io.InputStream;
8 |
9 | /**
10 | * Created by piek on 1/3/14.
11 | */
12 | public class RdfReader {
13 |
14 |
15 | static void readRdfFile (String pathToRdfFile) {
16 | // create an empty model
17 | Model model = ModelFactory.createDefaultModel();
18 |
19 | // use the FileManager to find the input file
20 | InputStream in = FileManager.get().open( pathToRdfFile );
21 | if (in == null) {
22 | throw new IllegalArgumentException(
23 | "File: " + pathToRdfFile + " not found");
24 | }
25 |
26 | // read the RDF/XML file
27 | model.read(in, null);
28 |
29 | // write it to standard out
30 | model.write(System.out);
31 | }
32 |
33 |
34 | static public void main (String[] args) {
35 | // String pathToRdfFile = args[0];
36 | String pathToRdfFile = "/Users/piek/Desktop/example.rdf";
37 | readRdfFile(pathToRdfFile);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/input/SelectEntityTrig.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.input;
2 |
3 | import com.hp.hpl.jena.query.Dataset;
4 | import com.hp.hpl.jena.rdf.model.Model;
5 | import com.hp.hpl.jena.rdf.model.Statement;
6 | import com.hp.hpl.jena.rdf.model.StmtIterator;
7 | import com.hp.hpl.jena.tdb.TDBFactory;
8 | import eu.newsreader.eventcoreference.util.Util;
9 | import org.apache.jena.riot.RDFDataMgr;
10 |
11 | import java.io.*;
12 | import java.util.ArrayList;
13 |
14 | /**
15 | * Created by piek on 15/06/15.
16 | */
17 | public class SelectEntityTrig {
18 |
19 |
20 | static Dataset dataset = null;
21 |
22 | static public void main (String[] args) {
23 |
24 | String trigfolderPath = "";
25 | trigfolderPath = "/Users/piek/Desktop/tweede-kamer/events";
26 | String entity = "";
27 | String date = "";
28 | entity = "lippens";
29 | for (int i = 0; i < args.length; i++) {
30 | String arg = args[i];
31 | if (arg.equals("--trig-folder") && args.length>(i+1)) {
32 | trigfolderPath = args[i+1];
33 | }
34 | else if (arg.equals("--entity") && args.length>(i+1)) {
35 | entity = args[i+1];
36 | }
37 | else if (arg.equals("--event-date") && args.length>(i+1)) {
38 | date = args[i+1];
39 | }
40 | }
41 | if (entity.isEmpty()) {
42 | System.out.println("Entity is empty");
43 | return;
44 | }
45 | File trigfolder = new File(trigfolderPath);
46 | String trigEntityPath = trigfolder.getParent()+"/"+entity;
47 | File entityTrigFolder = new File (trigEntityPath);
48 | if (!entityTrigFolder.exists()) {
49 | entityTrigFolder.mkdir();
50 | }
51 | if (!entityTrigFolder.exists()) {
52 | System.out.println("Could not create entity trig folder");
53 | return;
54 | }
55 | dataset = TDBFactory.createDataset();
56 | ArrayList trigFiles = Util.makeRecursiveFileList(trigfolder, ".trig");
57 | System.out.println(trigfolder.getName() + " trigFiles.size() = " + trigFiles.size());
58 | int cnt = 1;
59 | for (int i = 0; i < trigFiles.size(); i++) {
60 | File file = trigFiles.get(i);
61 | if (!file.getParentFile().getName().startsWith(date)) {
62 | continue;
63 | }
64 | if (i%500==0) {
65 | System.out.println("i = " + i);
66 | // if (i>1000) break;
67 | }
68 | ArrayList events = new ArrayList();
69 | dataset = RDFDataMgr.loadDataset(file.getAbsolutePath());
70 | Model namedModel = dataset.getNamedModel(TrigUtil.instanceGraph);
71 | StmtIterator siter = namedModel.listStatements();
72 | while (siter.hasNext()) {
73 | Statement s = siter.nextStatement();
74 | String subject = s.getSubject().getURI().toLowerCase();
75 | if (subject.indexOf(entity.toLowerCase())>-1) {
76 | String trigName = trigEntityPath+"/"+cnt+"_"+file.getName();
77 | File trigCopy = new File(trigName);
78 | copyFile(file, trigCopy);
79 | cnt++;
80 | break;
81 | }
82 | }
83 | dataset = null;
84 | }
85 | }
86 |
87 | static public void copyFile(File inputFile, File outputFile) {
88 | try {
89 | DataInputStream in = new DataInputStream(new FileInputStream(inputFile));
90 | byte[] buffer = new byte[(int) inputFile.length()];
91 | in.readFully(buffer);
92 | in.close();
93 | DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile));
94 | out.write(buffer);
95 | } catch (IOException e) {
96 | e.printStackTrace();
97 | }
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/input/TrigTripleData.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.input;
2 |
3 | import com.hp.hpl.jena.rdf.model.Statement;
4 |
5 | import java.io.IOException;
6 | import java.io.OutputStream;
7 | import java.util.*;
8 |
9 | /**
10 | * Created by piek on 05/02/16.
11 | */
12 | public class TrigTripleData {
13 |
14 |
15 | static final public String provenanceGraph = "http://www.newsreader-project.eu/provenance";
16 | static final public String instanceGraph = "http://www.newsreader-project.eu/instances";
17 | static final public String graspGraph = "http://www.newsreader-project.eu/grasp";
18 | public HashMap> tripleMapGrasp = new HashMap>();
19 | public HashMap> tripleMapProvenance = new HashMap>();
20 | public HashMap> tripleMapLabels = new HashMap>();
21 | public HashMap> tripleMapInstances = new HashMap>();
22 | public HashMap> tripleMapOthers = new HashMap>();
23 | public Vector perspectiveMentions = new Vector();
24 |
25 | public TrigTripleData() {
26 | tripleMapLabels = new HashMap>();
27 | tripleMapGrasp = new HashMap>();
28 | tripleMapProvenance = new HashMap>();
29 | tripleMapInstances = new HashMap>();
30 | tripleMapOthers = new HashMap>();
31 | perspectiveMentions = new Vector();
32 | }
33 |
34 | public void dumpTriples (OutputStream fos, HashMap> map) throws IOException {
35 | Set keyset = map.keySet();
36 | Iterator keys = keyset.iterator();
37 | while (keys.hasNext()) {
38 | String key = keys.next();
39 | ArrayList statements = map.get(key);
40 | for (int i = 0; i < statements.size(); i++) {
41 | Statement statement = statements.get(i);
42 | String str = statement.toString()+"\n";
43 | fos.write(str.getBytes());
44 | }
45 | }
46 | }
47 |
48 | public void dumpInstanceTriples (OutputStream fos) throws IOException {
49 | Set keyset = tripleMapInstances.keySet();
50 | Iterator keys = keyset.iterator();
51 | while (keys.hasNext()) {
52 | String key = keys.next();
53 | ArrayList statements = tripleMapInstances.get(key);
54 | for (int i = 0; i < statements.size(); i++) {
55 | Statement statement = statements.get(i);
56 | String str = statement.toString()+"\n";
57 | fos.write(str.getBytes());
58 | }
59 | }
60 | }
61 |
62 | public void dumpOtherTriples (OutputStream fos) throws IOException {
63 | Set keyset = tripleMapOthers.keySet();
64 | Iterator keys = keyset.iterator();
65 | while (keys.hasNext()) {
66 | String key = keys.next();
67 | ArrayList statements = tripleMapOthers.get(key);
68 | for (int i = 0; i < statements.size(); i++) {
69 | Statement statement = statements.get(i);
70 | String str = statement.toString()+"\n";
71 | fos.write(str.getBytes());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/naf/GetSemFromNafStream.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.naf;
2 |
3 | import eu.kyotoproject.kaf.KafSaxParser;
4 | import eu.newsreader.eventcoreference.coref.ComponentMatch;
5 | import eu.newsreader.eventcoreference.objects.*;
6 | import eu.newsreader.eventcoreference.output.JenaSerialization;
7 | import eu.newsreader.eventcoreference.util.FrameTypes;
8 | import eu.newsreader.eventcoreference.util.MD5Checksum;
9 | import org.apache.jena.atlas.logging.Log;
10 |
11 | import java.util.ArrayList;
12 |
13 | /**
14 | * Created by piek on 2/12/14.
15 | */
16 | public class GetSemFromNafStream {
17 |
18 | static public void main(String[] args) {
19 | Log.setLog4j("jena-log4j.properties");
20 | NafSemParameters nafSemParameters = new NafSemParameters(args);
21 |
22 |
23 | ArrayList semEvents = new ArrayList();
24 | ArrayList semActors = new ArrayList();
25 | ArrayList semTimes = new ArrayList();
26 | ArrayList semRelations = new ArrayList();
27 | KafSaxParser kafSaxParser = new KafSaxParser();
28 | kafSaxParser.parseFile(System.in);
29 | if (kafSaxParser.getKafMetaData().getUrl().isEmpty()) {
30 | //System.err.println("ERROR! Empty url in header NAF. Cannot create unique URIs! Aborting");
31 | try {
32 | String checkSum = MD5Checksum.getMD5ChecksumFromString(kafSaxParser.rawText);
33 | // System.err.println("checkSum = " + checkSum);
34 | kafSaxParser.getKafMetaData().setUrl(checkSum);
35 | } catch (Exception e) {
36 | // e.printStackTrace();
37 | }
38 | }
39 | GetSemFromNaf.processNafFile(nafSemParameters, kafSaxParser, semEvents, semActors, semTimes, semRelations );
40 | ArrayList compositeEventArraylist = new ArrayList();
41 | for (int j = 0; j < semEvents.size(); j++) {
42 | SemEvent mySemEvent = (SemEvent) semEvents.get(j);
43 | ArrayList myTimes = ComponentMatch.getMySemTimes(mySemEvent, semRelations, semTimes);
44 | ArrayList myActors = ComponentMatch.getMySemActors(mySemEvent, semRelations, semActors);
45 | ArrayList myRelations = ComponentMatch.getMySemRelations(mySemEvent, semRelations);
46 | CompositeEvent compositeEvent = new CompositeEvent(mySemEvent, myActors, myTimes, myRelations);
47 | if (myTimes.size() <= nafSemParameters.getTIMEEXPRESSIONMAX()) {
48 | if (compositeEvent.isValid()) {
49 | FrameTypes.setEventTypeString(compositeEvent.getEvent(), nafSemParameters);
50 | compositeEventArraylist.add(compositeEvent);
51 | }
52 | else {
53 | /*
54 | System.out.println("Skipping EVENT due to no time anchor and/or no participant");
55 | System.out.println("compositeEvent = " + compositeEvent.getEvent().getURI());
56 | System.out.println("myTimes = " + myTimes.size());
57 | System.out.println("myActors = " + myActors.size());
58 | System.out.println("myRelations = " + myRelations.size());
59 | */
60 | }
61 | } else {
62 | /*
63 | System.out.println("Skipping event due to excessive time expressions linked to it");
64 | System.out.println("compositeEvent = " + compositeEvent.getEvent().getURI());
65 | System.out.println("myTimes.size() = " + myTimes.size());
66 | */
67 | }
68 | }
69 | if (!nafSemParameters.isPERSPECTIVE()) {
70 | JenaSerialization.serializeJenaCompositeEvents(System.out, compositeEventArraylist, null, nafSemParameters.isILIURI(), nafSemParameters.isVERBOSE());
71 | }
72 | else {
73 | ArrayList sourcePerspectives = GetPerspectiveRelations.getSourcePerspectives(kafSaxParser,
74 | semActors,
75 | semEvents,
76 | nafSemParameters);
77 | ArrayList documentPerspectives = GetPerspectiveRelations.getAuthorPerspectives(
78 | kafSaxParser, nafSemParameters.getPROJECT(), sourcePerspectives);
79 | JenaSerialization.serializeJenaCompositeEventsAndPerspective(System.out, compositeEventArraylist, kafSaxParser, nafSemParameters.getPROJECT(), sourcePerspectives, documentPerspectives);
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/naf/GetSimpleSemFromNafStream.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.naf;
2 |
3 | import eu.kyotoproject.kaf.KafSaxParser;
4 | import eu.newsreader.eventcoreference.coref.ComponentMatch;
5 | import eu.newsreader.eventcoreference.objects.*;
6 | import eu.newsreader.eventcoreference.output.JenaSerialization;
7 | import eu.newsreader.eventcoreference.output.SimpleTaxonomy;
8 | import eu.newsreader.eventcoreference.util.FrameTypes;
9 | import eu.newsreader.eventcoreference.util.MD5Checksum;
10 | import org.apache.jena.atlas.logging.Log;
11 |
12 | import java.util.ArrayList;
13 | import java.util.HashMap;
14 |
15 | /**
16 | * Created by piek on 2/12/14.
17 | */
18 | public class GetSimpleSemFromNafStream {
19 | /*
20 |
21 | static final String USAGE = "This program processes a single NAF file and generates SEM RDF-TRiG results" +
22 | "The program has the following arguments:\n" +
23 | "--project \n" +
24 | "--contextual-frames \n" +
25 | "--communication-frames \n" +
26 | "--grammatical-frames " +
27 | ;
28 |
29 | static public Vector sourceVector = null;
30 | static public Vector grammaticalVector = null;
31 | static public Vector contextualVector = null;
32 | static public int TIMEEXPRESSIONMAX = 5;
33 | static public boolean NONENTITIES = false;
34 | static public boolean ILIURI = false;
35 | static public boolean VERBOSE = false;
36 | static public boolean PERSPECTIVE = false;
37 |
38 | static boolean DOCTIME = true;
39 | static boolean CONTEXTTIME = true;
40 |
41 | static boolean NOMCOREF = true;
42 | static boolean EVENTCOREF = true;
43 | */
44 | static public void main(String[] args) {
45 | Log.setLog4j("jena-log4j.properties");
46 | NafSemParameters nafSemParameters = new NafSemParameters(args);
47 |
48 |
49 | ArrayList semEvents = new ArrayList();
50 | ArrayList semActors = new ArrayList();
51 | ArrayList semTimes = new ArrayList();
52 | ArrayList semRelations = new ArrayList();
53 | KafSaxParser kafSaxParser = new KafSaxParser();
54 | kafSaxParser.parseFile(System.in);
55 | if (kafSaxParser.getKafMetaData().getUrl().isEmpty()) {
56 | //System.err.println("ERROR! Empty url in header NAF. Cannot create unique URIs! Aborting");
57 | try {
58 | String checkSum = MD5Checksum.getMD5ChecksumFromString(kafSaxParser.rawText);
59 | // System.err.println("checkSum = " + checkSum);
60 | kafSaxParser.getKafMetaData().setUrl(checkSum);
61 | } catch (Exception e) {
62 | // e.printStackTrace();
63 | }
64 | }
65 | GetSemFromNaf.processNafFile(nafSemParameters, kafSaxParser, semEvents, semActors, semTimes, semRelations );
66 | ArrayList compositeEventArraylist = new ArrayList();
67 | for (int j = 0; j < semEvents.size(); j++) {
68 | SemEvent mySemEvent = (SemEvent) semEvents.get(j);
69 | ArrayList myTimes = ComponentMatch.getMySemTimes(mySemEvent, semRelations, semTimes);
70 | ArrayList myActors = ComponentMatch.getMySemActors(mySemEvent, semRelations, semActors);
71 | ArrayList myRelations = ComponentMatch.getMySemRelations(mySemEvent, semRelations);
72 | CompositeEvent compositeEvent = new CompositeEvent(mySemEvent, myActors, myTimes, myRelations);
73 | if (myTimes.size() <= nafSemParameters.getTIMEEXPRESSIONMAX()) {
74 | if (compositeEvent.isValid()) {
75 | FrameTypes.setEventTypeString(compositeEvent.getEvent(), nafSemParameters);
76 | compositeEventArraylist.add(compositeEvent);
77 | }
78 | else {
79 | /*
80 | System.out.println("Skipping EVENT due to no time anchor and/or no participant");
81 | System.out.println("compositeEvent = " + compositeEvent.getEvent().getURI());
82 | System.out.println("myTimes = " + myTimes.size());
83 | System.out.println("myActors = " + myActors.size());
84 | System.out.println("myRelations = " + myRelations.size());
85 | */
86 | }
87 | } else {
88 | /*
89 | System.out.println("Skipping event due to excessive time expressions linked to it");
90 | System.out.println("compositeEvent = " + compositeEvent.getEvent().getURI());
91 | System.out.println("myTimes.size() = " + myTimes.size());
92 | */
93 | }
94 | }
95 | JenaSerialization.serializeJenaSimpleCompositeEvents(System.out, compositeEventArraylist, new SimpleTaxonomy(), new HashMap());
96 | }
97 | }
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/objects/CorefMatch.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.objects;
2 |
3 | import eu.kyotoproject.kaf.CorefTarget;
4 |
5 | import java.util.ArrayList;
6 |
7 | /**
8 | * Created by piek on 10/10/14.
9 | */
10 | public class CorefMatch {
11 | private double score;
12 | private String lowestCommonSubsumer;
13 | private String targetLemma;
14 | private ArrayList> corefTargets;
15 |
16 | public CorefMatch() {
17 | this.score = -1;
18 | this.lowestCommonSubsumer = "";
19 | this.targetLemma = "";
20 | this.corefTargets = new ArrayList>();
21 | }
22 |
23 | public String getTargetLemma() {
24 | return targetLemma;
25 | }
26 |
27 | public void setTargetLemma(String targetLemma) {
28 | this.targetLemma = targetLemma;
29 | }
30 |
31 | public double getScore() {
32 | return score;
33 | }
34 |
35 | public void setScore(double score) {
36 | this.score = score;
37 | }
38 |
39 | public void addScore(double score) {
40 | this.score +=score;
41 | }
42 |
43 | public String getLowestCommonSubsumer() {
44 | return lowestCommonSubsumer;
45 | }
46 |
47 | public void setLowestCommonSubsumer(String lowestCommonSubsumer) {
48 | this.lowestCommonSubsumer = lowestCommonSubsumer;
49 | }
50 |
51 | public ArrayList> getCorefTargets() {
52 | return corefTargets;
53 | }
54 |
55 | public void addCorefTargets(ArrayList corefTargets) {
56 | this.corefTargets.add(corefTargets);
57 | }
58 |
59 | public void setCorefTargets(ArrayList> corefTargets) {
60 | this.corefTargets = corefTargets;
61 | }
62 |
63 | public boolean hasSpan (ArrayList spans) {
64 | for (int i = 0; i < corefTargets.size(); i++) {
65 | ArrayList targets = corefTargets.get(i);
66 | int overlap = CorefTarget.overlapSetOfSpans(targets, spans);
67 | if (overlap==corefTargets.size() && (overlap==spans.size())) {
68 | /// exact match
69 | return true;
70 | }
71 | }
72 | return false;
73 | }
74 |
75 | public boolean hasIntersection (ArrayList spans) {
76 | for (int i = 0; i < corefTargets.size(); i++) {
77 | ArrayList targets = corefTargets.get(i);
78 | int overlap = CorefTarget.overlapSetOfSpans(targets, spans);
79 | if (overlap>0) {
80 | /// exact match
81 | return true;
82 | }
83 | }
84 | return false;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/eu/newsreader/eventcoreference/objects/CorefTriple.java:
--------------------------------------------------------------------------------
1 | package eu.newsreader.eventcoreference.objects;
2 |
3 | import java.util.ArrayList;
4 |
5 | /**
6 | * Created with IntelliJ IDEA.
7 | * User: kyoto
8 | * Date: 10/11/13
9 | * Time: 6:35 PM
10 | * To change this template use File | Settings | File Templates.
11 | */
12 | public class CorefTriple {
13 |
14 | private String id;
15 | private String predicate;
16 | private String subject;
17 | private String object;
18 | private ArrayList mentions;
19 | private String comment;
20 |
21 | public CorefTriple() {
22 | this.id = "";
23 | this.object = "";
24 | this.predicate = "";
25 | this.subject = "";
26 | this.comment = "";
27 | this.mentions = new ArrayList();
28 | }
29 |
30 | public CorefTriple(String predicate, String subject, String object) {
31 | this.id = "";
32 | this.comment = "";
33 | this.object = object;
34 | this.predicate = predicate;
35 | this.subject = subject;
36 | this.mentions = new ArrayList();
37 | }
38 |
39 | public String getComment() {
40 | return comment;
41 | }
42 |
43 | public void setComment(String comment) {
44 | this.comment = comment;
45 | }
46 |
47 | public void addComment(String comment) {
48 | this.comment += comment;
49 | }
50 |
51 | public ArrayList getMentions() {
52 | return mentions;
53 | }
54 |
55 | public void setMentions(ArrayList mentions) {
56 | this.mentions = mentions;
57 | }
58 |
59 | public void addMentions(String mention) {
60 | this.mentions.add(mention);
61 | }
62 |
63 | public String getObject() {
64 | return object;
65 | }
66 |
67 | public void setObject(String object) {
68 | this.object = object;
69 | }
70 |
71 | public String getPredicate() {
72 | return predicate;
73 | }
74 |
75 | public void setPredicate(String predicate) {
76 | this.predicate = predicate;
77 | }
78 |
79 | public String getSubject() {
80 | return subject;
81 | }
82 |
83 | public void setSubject(String subject) {
84 | this.subject = subject;
85 | }
86 |
87 | public String getId() {
88 | return id;
89 | }
90 |
91 | public void setId(String id) {
92 | this.id = id;
93 | }
94 |
95 | public String toString () {
96 | String str = "\t\n";
101 | // str += "