|
| 1 | +Annotated Gigaword API and Command Line Tools v1.0 - July 21, 2012 |
| 2 | +------------------------------------------------------------------ |
| 3 | + |
| 4 | +This release includes a Java API and command line tools for reading |
| 5 | +the Annotated Gigaword dataset XML files. |
| 6 | + |
| 7 | +------------------- |
| 8 | +Project Hosting : |
| 9 | +------------------- |
| 10 | + |
| 11 | +For the latest version, go to: |
| 12 | +http://code.google.com/p/agiga |
| 13 | + |
| 14 | +------------------- |
| 15 | +Command Line Tools: |
| 16 | +------------------- |
| 17 | + |
| 18 | +The command line tools provide a convenient way to print human |
| 19 | +readable versions of the XML annotations. The entry point is |
| 20 | +edu.jhu.agiga.AgigaPrinter and it has the following usage. |
| 21 | + |
| 22 | +usage: java edu.jhu.agiga.AgigaPrinter <type> <gzipped input file> |
| 23 | + where <type> is one of: |
| 24 | + words (Words only, one sentence per line) |
| 25 | + lemmas (Lemmas only, one sentence per line) |
| 26 | + pos (Part-of-speech tags) |
| 27 | + ner (Named entity types) |
| 28 | + basic-deps (Basic dependency parses in CONNL-X format) |
| 29 | + col-deps (Collapsed dependency parses in CONNL-X format) |
| 30 | + col-ccproc-deps (Collapsed and propagated dependency parses in CONNL-X format) |
| 31 | + phrase-structure (Phrase structure parses) |
| 32 | + coref (Coreference resolution as SGML similar to MUC) |
| 33 | + stanford-deps (toString() methods of Stanford dependency parse annotations) |
| 34 | + stanford-phrase-structure (toString() method of Stanford phrase structure parses) |
| 35 | + for-testing-only (**For use in testing this API only**) |
| 36 | + and where <gzipped input file> is an .xml.gz file |
| 37 | + from Annotated Gigaword |
| 38 | + |
| 39 | +For example, to print part-of-speech tags for the file |
| 40 | +nyt_eng_199911.xml.gz, we could run: |
| 41 | + |
| 42 | +java -cp build/agiga-1.0.jar:lib/* edu.jhu.agiga.AgigaPrinter pos annotated_gigaword/nyt_eng_199911.xml.gz |
| 43 | + |
| 44 | +------------------- |
| 45 | +Java API : |
| 46 | +------------------- |
| 47 | + |
| 48 | +The Java API provides streaming access to the documents in the .xml.gz |
| 49 | +files. Two iterators are provided: StreamingDocumentReader and |
| 50 | +StreamingSentenceReader. Both of these take as input the path to an |
| 51 | +Annotated Gigaword file and an AgigaPrefs object. |
| 52 | + |
| 53 | +By default, the AgigaPrefs constructor will ensure that every |
| 54 | +annotation in the XML is read in and that the resulting objects are |
| 55 | +fully populated. However, by turning off certain options, it's |
| 56 | +possible to skip the reading and creation of objects corresponding to |
| 57 | +unused annotations. |
| 58 | + |
| 59 | +StreamingDocumentReader is an iterator over AgigaDocument objects. The |
| 60 | +AgigaDocument class gives access to the coreference resolution (via |
| 61 | +AgigaCoref objects) annotations and the sentences (via AgigaSentence |
| 62 | +objects). |
| 63 | + |
| 64 | +StreamingSentenceReader is an iterator over AgigaSentence |
| 65 | +objects. This bypasses the document level annotations such as coref |
| 66 | +and the document ids and provides direct access to the sentence |
| 67 | +annotations only. |
| 68 | + |
| 69 | +AgigaPrinter provides examples of how to use these iterators and set |
| 70 | +the AgigaPrefs object so that only the necessary annotations are read. |
| 71 | +Examples of how to use the Agiga objects can also be found in the |
| 72 | +AgigaDocument.write* and AgigaSentence.write* methods. |
| 73 | + |
| 74 | +---------------------- |
| 75 | +One- vs. Zero-Indexing: |
| 76 | +---------------------- |
| 77 | + |
| 78 | +In the XML, the sentences and tokens are given Ids that are |
| 79 | +one-indexed. However, we find it to be more convenient to work with |
| 80 | +zero-indexed **indices** in the Java API. Accordingly, the Java API |
| 81 | +does not provide access to these original Ids but instead provides |
| 82 | +access to indices. These indices are accessed via methods named |
| 83 | +get*Idx(), such as AgigaSentence.getIdx() and |
| 84 | +AgigaMention.getSentenceIdx() -- or AgigaToken.getIdx() and |
| 85 | +AgigaDependency.getGovIdx(). These indices also correspond to the |
| 86 | +ordered elements in the Lists used throughout the API. |
| 87 | + |
| 88 | +Of course, the original Ids from the XML can be recovered by adding |
| 89 | +one to the indices in the API. However, we didn't want to confuse the |
| 90 | +issue by providing API calls for both. |
| 91 | + |
| 92 | +------------------- |
| 93 | +Building : |
| 94 | +------------------- |
| 95 | + |
| 96 | +A build.xml is provided for building with Apache Ant. Example |
| 97 | +commands are below and should be run from the top level directory that |
| 98 | +contains the build.xml. |
| 99 | + |
| 100 | +# To compile: |
| 101 | +ant |
| 102 | + |
| 103 | +# To clean and compile |
| 104 | +ant clean compile |
| 105 | + |
| 106 | +# To build jars of classes and sources: |
| 107 | +ant jar |
0 commit comments