@@ -0,0 +1,2495 @@
+package edu.umass.cs.jfoley.coop;%0A%0Aimport ciir.jfoley.chai.io.Directory;%0Aimport ciir.jfoley.chai.io.LinesIterable;%0Aimport ciir.jfoley.chai.time.Debouncer;%0Aimport edu.umass.cs.jfoley.coop.document.CoopDoc;%0Aimport edu.umass.cs.jfoley.coop.index.IndexBuilder;%0Aimport edu.umass.cs.jfoley.coop.schema.IndexConfiguration;%0Aimport org.lemurproject.galago.utility.Parameters;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * @author jfoley%0A */%0Apublic class BuildIndexAnno %7B%0A  public static void main(String%5B%5D args) throws IOException %7B%0A    File input = new File(%22bills-data/billfiles.standard.anno.gz%22);%0A%0A    IndexConfiguration cfg = IndexConfiguration.create();%0A%0A    Debouncer msg = new Debouncer(1000);%0A%0A    try (IndexBuilder builder = new IndexBuilder(cfg, new Directory(%22bills.index%22))) %7B%0A      try (LinesIterable lines = LinesIterable.fromFile(input)) %7B%0A        for (String line : lines) %7B%0A          String%5B%5D dat = line.split(%22%5Ct%22);%0A          String name = dat%5B0%5D;%0A          Parameters docInfo = Parameters.parseString(dat%5B1%5D);%0A          if (docInfo.keySet().size() != 1) %7B%0A            System.err.println(docInfo.keySet());%0A          %7D%0A          List%3CParameters%3E info = docInfo.getList(%22sentences%22, Parameters.class);%0A%0A          CoopDoc doc = new CoopDoc();%0A          doc.setName(name);%0A%0A          List%3CString%3E pos = new ArrayList%3C%3E();%0A          List%3CString%3E lemmas = new ArrayList%3C%3E();%0A          List%3CString%3E tokens = new ArrayList%3C%3E();%0A          if (msg.ready()) %7B%0A            int n = lines.getLineNumber();%0A            System.out.println(%22#%22 + n + %22 %22 + name + %22 %22 + info.size());%0A            System.out.println(msg.estimate(n, 88232));%0A            if (n %3E 3000) break;%0A          %7D%0A          for (Parameters sentence : info) %7B%0A            List%3CString%3E spos = sentence.getAsList(%22pos%22, String.class);%0A            int start = pos.size();%0A            int end = start + spos.size();%0A            doc.addTag(%22sentence%22, start, end);%0A            pos.addAll(spos);%0A            lemmas.addAll(sentence.getAsList(%22lemmas%22, String.class));%0A            tokens.addAll(sentence.getAsList(%22tokens%22, String.class));%0A          %7D%0A%0A          doc.setTerms(%22tokens%22, tokens);%0A          doc.setTerms(%22lemmas%22, lemmas);%0A          doc.setTerms(%22pos%22, pos);%0A          doc.setRawText(line);%0A          builder.addDocument(doc);%0A        %7D%0A      %7D // lines%0A      System.out.println(%22Done Reading!%22);%0A    %7D // builder%0A%0A    System.out.println(%22Done Indexing!%22);%0A  %7D%0A%7D%0A

Build MTE-style index from @brendano's anno files