Package org.apache.uima.ruta.resource

Examples of org.apache.uima.ruta.resource.MultiTreeWordList


      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
          if (list.endsWith("mtwl")) {
            wordLists.put(list, new MultiTreeWordList(resource));
          } else {
            wordLists.put(list, new TreeWordList(resource));
          }
        } catch (IOException e) {
          Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
View Full Code Here


      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
          if (list.endsWith("mtwl")) {
            wordLists.put(list, new MultiTreeWordList(resource));
          } else {
            wordLists.put(list, new TreeWordList(resource));
          }
        } catch (IOException e) {
          Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
View Full Code Here

            paths.addAll(getPaths(resource));
          }
        }
        monitor.beginTask("Compiling generated.mtwl...", 1);
        if (!paths.isEmpty()) {
          MultiTreeWordList trie;
          try {
            trie = new MultiTreeWordList(paths.toArray(new String[0]));
          } catch (IOException e) {
            RutaAddonsPlugin.error(e);
            return Status.CANCEL_STATUS;
          }

          IPath parent = first.getLocation().removeLastSegments(1);
          IPath newPath = parent.append("generated.mtwl");

          File file = newPath.toFile();
          final String absolutePath = file.getAbsolutePath();

          trie.createMTWLFile(absolutePath);

          IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
          IContainer container = myWorkspaceRoot.getContainerForLocation(parent);
          if (container != null) {
            try {
View Full Code Here

            paths.addAll(getPaths(resource));
          }
        }
        monitor.beginTask("Compiling generated.mtwl...", 1);
        if (!paths.isEmpty()) {
          MultiTreeWordList trie;
          try {
            trie = new MultiTreeWordList(paths.toArray(new String[0]));
          } catch (IOException e) {
            RutaAddonsPlugin.error(e);
            return Status.CANCEL_STATUS;
          }

          IPath parent = first.getLocation().removeLastSegments(1);
          IPath newPath = parent.append("generated.mtwl");

          File file = newPath.toFile();
          final String absolutePath = file.getAbsolutePath();

          trie.createMTWLFile(absolutePath);

          IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
          IContainer container = myWorkspaceRoot.getContainerForLocation(parent);
          // final String localPath = container.getProjectRelativePath() + "/" + container.getName()
          // + "/" + "generated.mtwl";
View Full Code Here

            continue;
          }
          found = true;
          try {
            if (file.getName().endsWith("mtwl")) {
              wordLists.put(list, new MultiTreeWordList(file.getAbsolutePath()));
            } else {
              wordLists.put(list, new TreeWordList(file.getAbsolutePath()));
            }
          } catch (IOException e) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
                    "Error reading word list", e);
            found = false;
          }
          break;
        }
      }
      if (!found) {
        InputStream stream = ClassLoader.getSystemResourceAsStream(list);
        if (stream != null) {
          found = true;
          try {
            if (list.endsWith(".mtwl"))
              wordLists.put(list, new MultiTreeWordList(stream, list));
            else
              wordLists.put(list, new TreeWordList(stream, list));
          } catch (IOException e) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
                    "Error reading word list from classpath", e);
View Full Code Here

      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
          if (list.endsWith("mtwl")) {
            wordLists.put(list, new MultiTreeWordList(resource));
          } else {
            wordLists.put(list, new TreeWordList(resource));
          }
        } catch (IOException e) {
          Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.resource.MultiTreeWordList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.