Search in sources :

Example 11 with DiskTreebank

use of edu.stanford.nlp.trees.DiskTreebank in project CoreNLP by stanfordnlp.

the class FileTreeModel method addFileFolder.

/**
   * Forks off a new thread to load your files based on the filters you set in the interface
   */
public void addFileFolder(final EnumMap<FilterType, String> filters, final File[] files) {
    List<FileTreeNode> newFiles = new ArrayList<>();
    //findLoadableFiles updates newFiles
    findLoadableFiles(filters, files, newFiles, FileTreeModel.this.getRoot());
    for (FileTreeNode fileNode : newFiles) {
        Treebank treebank = new DiskTreebank(trf, curEncoding);
        treebank.loadPath(fileNode.getFile(), null, true);
        TreeTransformer transformer = TregexGUI.getInstance().transformer;
        if (transformer != null) {
            treebank = new TransformingTreebank(treebank, transformer);
        }
        fileNode.setTreebank(treebank);
    }
    // System.out.println("Loadable files are: " + newFiles);
    FileTreeModel.this.fireTreeStructureChanged(new TreePath(getRoot()));
}
Also used : DiskTreebank(edu.stanford.nlp.trees.DiskTreebank) TreePath(javax.swing.tree.TreePath) Treebank(edu.stanford.nlp.trees.Treebank) DiskTreebank(edu.stanford.nlp.trees.DiskTreebank) TransformingTreebank(edu.stanford.nlp.trees.TransformingTreebank) TransformingTreebank(edu.stanford.nlp.trees.TransformingTreebank) TreeTransformer(edu.stanford.nlp.trees.TreeTransformer)

Aggregations

DiskTreebank (edu.stanford.nlp.trees.DiskTreebank)11 Language (edu.stanford.nlp.international.Language)8 TreebankLangParserParams (edu.stanford.nlp.parser.lexparser.TreebankLangParserParams)8 Tree (edu.stanford.nlp.trees.Tree)8 PrintWriter (java.io.PrintWriter)7 ClassicCounter (edu.stanford.nlp.stats.ClassicCounter)6 ArrayList (java.util.ArrayList)6 EnglishTreebankParserParams (edu.stanford.nlp.parser.lexparser.EnglishTreebankParserParams)4 Properties (java.util.Properties)4 Treebank (edu.stanford.nlp.trees.Treebank)3 CoreLabel (edu.stanford.nlp.ling.CoreLabel)2 Label (edu.stanford.nlp.ling.Label)2 NumberFormat (java.text.NumberFormat)2 List (java.util.List)2 IOUtils (edu.stanford.nlp.io.IOUtils)1 NumberRangesFileFilter (edu.stanford.nlp.io.NumberRangesFileFilter)1 Lexicon (edu.stanford.nlp.parser.lexparser.Lexicon)1 Options (edu.stanford.nlp.parser.lexparser.Options)1 Counter (edu.stanford.nlp.stats.Counter)1 Counters (edu.stanford.nlp.stats.Counters)1