Package org.maltparserx.core.io.dataformat

Examples of org.maltparserx.core.io.dataformat.DataFormatInstance


        OptionManager.instance().overloadOptionValue(getOptionContainerIndex(), "singlemalt", "mode", modeName);
        ConfigurationDir configDir = (ConfigurationDir)flowChartinstance.getFlowChartRegistry(org.maltparserx.core.config.ConfigurationDir.class, idName);
        DataFormatManager dataFormatManager = configDir.getDataFormatManager();
       
        if (modeName.equals("learn")) {
          DataFormatInstance dataFormatInstance = null;
          if (dataFormatManager.getInputDataFormatSpec().getDataStructure() == DataStructure.PHRASE) {
            Set<Dependency> deps = dataFormatManager.getInputDataFormatSpec().getDependencies();
            String nullValueStrategy = OptionManager.instance().getOptionValue(getOptionContainerIndex(), "singlemalt", "null_value").toString();

            for (Dependency dep : dataFormatManager.getInputDataFormatSpec().getDependencies()) {
View Full Code Here


 
  public int preprocess(int signal) throws MaltChainedException {
    if (taskName.equals("init")) {
      ConfigurationDir configDir = (ConfigurationDir)flowChartinstance.getFlowChartRegistry(org.maltparserx.core.config.ConfigurationDir.class, idName);
//      SymbolTableHandler symbolTables = configDir.getSymbolTables();
      DataFormatInstance dataFormatInstance = configDir.getInputDataFormatInstance();
      marking_strategy = OptionManager.instance().getOptionValue(getOptionContainerIndex(), "pproj", "marking_strategy").toString().trim();
      covered_root = OptionManager.instance().getOptionValue(getOptionContainerIndex(), "pproj", "covered_root").toString().trim();
      lifting_order = OptionManager.instance().getOptionValue(getOptionContainerIndex(), "pproj", "lifting_order").toString().trim();
     
      if (!marking_strategy.equalsIgnoreCase("none") || !covered_root.equalsIgnoreCase("none")) {
View Full Code Here

      else if (mode.equals("parse")) {
        Set<Dependency> deps = dataFormatManager.getInputDataFormatSpec().getDependencies();
        String nullValueStategy = OptionManager.instance().getOptionValue(containerIndex, "singlemalt", "null_value").toString();
        for (Dependency dep : deps) {
//          URL depFormatURL = f.findURLinJars(dep.getUrlString());
          DataFormatInstance dataFormatInstance = dataFormatManager.getDataFormatSpec(dep.getDependentOn()).createDataFormatInstance(symbolTables, nullValueStategy);
          addDataFormatInstance(dataFormatManager.getDataFormatSpec(dep.getDependentOn()).getDataFormatName(), dataFormatInstance);
          dataFormatManager.setInputDataFormatSpec(dataFormatManager.getDataFormatSpec(dep.getDependentOn()));
//          dataFormatManager.setOutputDataFormatSpec(dataFormatManager.getDataFormatSpec(dep.getDependentOn()));
        }
      }
View Full Code Here

  public int preprocess(int signal) throws MaltChainedException {
    if (taskName.equals("create")) {
      boolean phrase = false;
      boolean dependency = false;
      ConfigurationDir configDir = (ConfigurationDir)flowChartinstance.getFlowChartRegistry(org.maltparserx.core.config.ConfigurationDir.class, idName);
      DataFormatInstance dataFormatInstance = null;
      DataFormatManager dataFormatManager = configDir.getDataFormatManager();
      SymbolTableHandler symbolTables = configDir.getSymbolTables();

     

      for (String key : configDir.getDataFormatInstanceKeys()) {
        DataFormatInstance dfi = configDir.getDataFormatInstance(key);
        if (dfi.getDataFormarSpec().getDataStructure() == DataStructure.PHRASE) {
          phrase = true;
        }
        if (dfi.getDataFormarSpec().getDataStructure() == DataStructure.DEPENDENCY) {
          dependency = true;
          dataFormatInstance = dfi;
        }
      }

      if (dependency == false && OptionManager.instance().getOptionValue(getOptionContainerIndex(), "config", "flowchart").toString().equals("learn")) {
        dependency = true;
        HashSet<Dependency> deps = dataFormatManager.getInputDataFormatSpec().getDependencies();
        String nullValueStategy = OptionManager.instance().getOptionValue(getOptionContainerIndex(), "singlemalt", "null_value").toString();
        for (Dependency dep : deps) {
          dataFormatInstance = dataFormatManager.getDataFormatSpec(dep.getDependentOn()).createDataFormatInstance(symbolTables, nullValueStategy);
          configDir.addDataFormatInstance(dataFormatManager.getOutputDataFormatSpec().getDataFormatName(), dataFormatInstance);
        }
      }

      if (dependency == true && phrase == false) {
        graph = new DependencyGraph(symbolTables);
        flowChartinstance.addFlowChartRegistry(org.maltparserx.core.syntaxgraph.DependencyStructure.class, structureName, graph);
      } else if (dependency == true && phrase == true) {
        graph = new MappablePhraseStructureGraph(symbolTables);
        final DataFormatInstance inFormat = configDir.getDataFormatInstance(dataFormatManager.getInputDataFormatSpec().getDataFormatName());
        final DataFormatInstance outFormat = configDir.getDataFormatInstance(dataFormatManager.getOutputDataFormatSpec().getDataFormatName());

        if (inFormat != null && outFormat != null) {
          LosslessMapping mapping = null;
          if (inFormat.getDataFormarSpec().getDataStructure() == DataStructure.DEPENDENCY) {
            mapping = new LosslessMapping(inFormat, outFormat);
View Full Code Here

  public DependencyStructure toDependencyStructure(String[] tokens, DataFormatSpecification dataFormatSpecification) throws MaltChainedException {
    // Creates a symbol table handler
    SymbolTableHandler symbolTables = new TrieSymbolTableHandler(TrieSymbolTableHandler.ADD_NEW_TO_TRIE);
   
    // Initialize data format instance
    DataFormatInstance dataFormatInstance = dataFormatSpecification.createDataFormatInstance(symbolTables, "none");

    // Creates a dependency graph
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to convert. ");
    }
    DependencyStructure outputGraph = new DependencyGraph(symbolTables);
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      Edge edge = null;
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
View Full Code Here

TOP

Related Classes of org.maltparserx.core.io.dataformat.DataFormatInstance

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.