Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-1154

change the XML format for feature generator config in NameFinder and POS Tagger

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.8.3
    • None
    • Name Finder
    • None

    Description

      NameFinder provides many kinds of feature generator (factories). Users can define their config via XML which looks like:

      <generators>
        <cache> 
          <generators>
            <window prevLength = "2" nextLength = "2">          
              <tokenclass/>
            </window>
            <window prevLength = "2" nextLength = "2">                
              <token/>
            </window>
            <definition/>
            <prevmap/>
            <bigram/>
            <sentence begin="true" end="false"/>
          </generators>
        </cache> 
      </generators>
      

      If a user wants to implement their own feature generator, he can use <custom .../>, but if he wants to have two or more feature generators at once, he may be able to implement it by providing a wrapper feature generator which wraps two or more feature generators that he originally wants to have, but it is not good.

      I'd like to suggest that we make the config format more flexible like below:

      <generator class="opennlp.tools.util.featuregen.AggregatedFeatureGeneratorFactory">
        <args>
          <generator class="opennlp.tools.util.featuregen.CachedFeatureGeneratorFactory">
            <args>
              <generator class="opennlp.tools.util.featuregen.AggregatedFeatureGeneratorFactory">
                <args>
                  <generator class="opennlp.tools.util.featuregen.WindowFeatureGeneratorFactory">
                    <args>
                      <int name="prevLength">2</int>
                      <int name="nextLength">2</int>
                      <generator class="opennlp.tools.util.featuregen.TokenClassFeatureGeneratorFactory"/>
                    </args>
                  </generator>
                  <generator class="opennlp.tools.util.featuregen.WindowFeatureGeneratorFactory">
                    <args>
                      <int name="prevLength">2</int>
                      <int name="nextLength">2</int>
                      <generator class="opennlp.tools.util.featuregen.TokenFeatureGeneratorFactory"/>
                    </args>
                  </generator>
                </args>
              </generator>
            </args>
          </generator>
        </args>
      </generator>
      

      If <args>...</args> is too noisy, I'm thinking another format as well:

      <generator class="opennlp.tools.util.featuregen.AggregatedFeatureGeneratorFactory">
        <generator class="opennlp.tools.util.featuregen.CachedFeatureGeneratorFactory">
          <generator class="opennlp.tools.util.featuregen.AggregatedFeatureGeneratorFactory">
            <generator class="opennlp.tools.util.featuregen.WindowFeatureGeneratorFactory">
              <int name="prevLength">2</int>
              <int name="nextLength">2</int>
              <generator class="opennlp.tools.util.featuregen.TokenClassFeatureGeneratorFactory"/>
            </generator>
            <generator class="opennlp.tools.util.featuregen.WindowFeatureGeneratorFactory">
              <int name="prevLength">2</int>
              <int name="nextLength">2</int>
              <generator class="opennlp.tools.util.featuregen.TokenFeatureGeneratorFactory"/>
            </generator>
          </generator>
        </generator>
      </generator>
      

      Attachments

        Issue Links

          Activity

            People

              koji Koji Sekiguchi
              koji Koji Sekiguchi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: