You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2011/11/07 19:48:26 UTC

svn commit: r1198869 - in /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref: mention/ShallowParseMentionFinder.java resolver/CommonNounResolver.java resolver/PerfectResolver.java sim/NumberEnum.java

Author: joern
Date: Mon Nov  7 18:48:25 2011
New Revision: 1198869

URL: http://svn.apache.org/viewvc?rev=1198869&view=rev
Log:
OPENNLP-357 Fixed inconsistent line ending style

Modified:
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/mention/ShallowParseMentionFinder.java
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/CommonNounResolver.java
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/PerfectResolver.java
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/sim/NumberEnum.java

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/mention/ShallowParseMentionFinder.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/mention/ShallowParseMentionFinder.java?rev=1198869&r1=1198868&r2=1198869&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/mention/ShallowParseMentionFinder.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/mention/ShallowParseMentionFinder.java Mon Nov  7 18:48:25 2011
@@ -15,64 +15,64 @@
  * limitations under the License.
  */
 
-package opennlp.tools.coref.mention;
-
-/**
- * Finds mentions from shallow np-chunking based parses.
- */
-public class ShallowParseMentionFinder extends AbstractMentionFinder {
-
-  private static ShallowParseMentionFinder instance;
-
-  private ShallowParseMentionFinder(HeadFinder hf) {
-    headFinder = hf;
-    collectPrenominalNamedEntities=true;
-    collectCoordinatedNounPhrases=true;
-  }
-
-  /**
-   * Retrieves the one and only existing instance.
-   *
-   * @param hf
-   * @return one and only existing instance
-   */
-  public static ShallowParseMentionFinder getInstance(HeadFinder hf) {
-    if (instance == null) {
-      instance = new ShallowParseMentionFinder(hf);
-    }
-    else if (instance.headFinder != hf) {
-      instance = new ShallowParseMentionFinder(hf);
-    }
-    return instance;
-  }
-
-  /*
-  protected final List getNounPhrases(Parse p) {
-    List nps = p.getNounPhrases();
-    List basals = new ArrayList();
-    for (int ni=0,ns=nps.size();ni<ns;ni++) {
-      Parse np = (Parse) nps.get(ni);
-      //System.err.println("getNounPhrases: np="+np);
-      if (isBasalNounPhrase(np)) {
-        //System.err.println("basal");
-        basals.add(np);
-      }
-      else if (isPossessive(np)) {
-        //System.err.println("pos np");
-        basals.add(np);
-        basals.addAll(getNounPhrases(np));
-      }
-      else if (isOfPrepPhrase(np)) {
-        //System.err.println("of np");
-        basals.add(np);
-        basals.addAll(getNounPhrases(np));
-      }
-      else {
-        //System.err.println("big np");
-        basals.addAll(getNounPhrases(np));
-      }
-    }
-    return(basals);
-  }
-  */
-}
+package opennlp.tools.coref.mention;
+
+/**
+ * Finds mentions from shallow np-chunking based parses.
+ */
+public class ShallowParseMentionFinder extends AbstractMentionFinder {
+
+  private static ShallowParseMentionFinder instance;
+
+  private ShallowParseMentionFinder(HeadFinder hf) {
+    headFinder = hf;
+    collectPrenominalNamedEntities=true;
+    collectCoordinatedNounPhrases=true;
+  }
+
+  /**
+   * Retrieves the one and only existing instance.
+   *
+   * @param hf
+   * @return one and only existing instance
+   */
+  public static ShallowParseMentionFinder getInstance(HeadFinder hf) {
+    if (instance == null) {
+      instance = new ShallowParseMentionFinder(hf);
+    }
+    else if (instance.headFinder != hf) {
+      instance = new ShallowParseMentionFinder(hf);
+    }
+    return instance;
+  }
+
+  /*
+  protected final List getNounPhrases(Parse p) {
+    List nps = p.getNounPhrases();
+    List basals = new ArrayList();
+    for (int ni=0,ns=nps.size();ni<ns;ni++) {
+      Parse np = (Parse) nps.get(ni);
+      //System.err.println("getNounPhrases: np="+np);
+      if (isBasalNounPhrase(np)) {
+        //System.err.println("basal");
+        basals.add(np);
+      }
+      else if (isPossessive(np)) {
+        //System.err.println("pos np");
+        basals.add(np);
+        basals.addAll(getNounPhrases(np));
+      }
+      else if (isOfPrepPhrase(np)) {
+        //System.err.println("of np");
+        basals.add(np);
+        basals.addAll(getNounPhrases(np));
+      }
+      else {
+        //System.err.println("big np");
+        basals.addAll(getNounPhrases(np));
+      }
+    }
+    return(basals);
+  }
+  */
+}

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/CommonNounResolver.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/CommonNounResolver.java?rev=1198869&r1=1198868&r2=1198869&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/CommonNounResolver.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/CommonNounResolver.java Mon Nov  7 18:48:25 2011
@@ -15,58 +15,58 @@
  * limitations under the License.
  */
 
-package opennlp.tools.coref.resolver;
-
+package opennlp.tools.coref.resolver;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 import opennlp.tools.coref.DiscourseEntity;
 import opennlp.tools.coref.mention.MentionContext;
-
-/**
- * Resolves coreference between common nouns.
- */
-public class CommonNounResolver extends MaxentResolver {
-
-  public CommonNounResolver(String projectName, ResolverMode m) throws IOException {
-    super(projectName,"cmodel", m, 80, true);
-    showExclusions = false;
-    preferFirstReferent = true;
-  }
-
-  public CommonNounResolver(String projectName, ResolverMode m, NonReferentialResolver nrr) throws IOException {
-    super(projectName,"cmodel", m, 80, true,nrr);
-    showExclusions = false;
-    preferFirstReferent = true;
-  }
-
+
+/**
+ * Resolves coreference between common nouns.
+ */
+public class CommonNounResolver extends MaxentResolver {
+
+  public CommonNounResolver(String projectName, ResolverMode m) throws IOException {
+    super(projectName,"cmodel", m, 80, true);
+    showExclusions = false;
+    preferFirstReferent = true;
+  }
+
+  public CommonNounResolver(String projectName, ResolverMode m, NonReferentialResolver nrr) throws IOException {
+    super(projectName,"cmodel", m, 80, true,nrr);
+    showExclusions = false;
+    preferFirstReferent = true;
+  }
+
   @Override
-  protected List<String> getFeatures(MentionContext mention, DiscourseEntity entity) {
-    List<String> features = new ArrayList<String>();
-    features.addAll(super.getFeatures(mention, entity));
-    if (entity != null) {
-      features.addAll(ResolverUtils.getContextFeatures(mention));
-      features.addAll(ResolverUtils.getStringMatchFeatures(mention,entity));
-    }
-    return features;
-  }
-
-  public boolean canResolve(MentionContext mention) {
-    String firstTok = mention.getFirstTokenText().toLowerCase();
-    String firstTokTag = mention.getFirstToken().getSyntacticType();
-    boolean rv = mention.getHeadTokenTag().equals("NN") && !ResolverUtils.definiteArticle(firstTok, firstTokTag);
-    return rv;
-  }
-
+  protected List<String> getFeatures(MentionContext mention, DiscourseEntity entity) {
+    List<String> features = new ArrayList<String>();
+    features.addAll(super.getFeatures(mention, entity));
+    if (entity != null) {
+      features.addAll(ResolverUtils.getContextFeatures(mention));
+      features.addAll(ResolverUtils.getStringMatchFeatures(mention,entity));
+    }
+    return features;
+  }
+
+  public boolean canResolve(MentionContext mention) {
+    String firstTok = mention.getFirstTokenText().toLowerCase();
+    String firstTokTag = mention.getFirstToken().getSyntacticType();
+    boolean rv = mention.getHeadTokenTag().equals("NN") && !ResolverUtils.definiteArticle(firstTok, firstTokTag);
+    return rv;
+  }
+
   @Override
-  protected boolean excluded(MentionContext ec, DiscourseEntity de) {
-    if (super.excluded(ec, de)) {
-      return true;
-    }
-    else {
-      MentionContext cec = de.getLastExtent();
-      return !canResolve(cec) || super.excluded(ec, de);
-    }
-  }
-}
+  protected boolean excluded(MentionContext ec, DiscourseEntity de) {
+    if (super.excluded(ec, de)) {
+      return true;
+    }
+    else {
+      MentionContext cec = de.getLastExtent();
+      return !canResolve(cec) || super.excluded(ec, de);
+    }
+  }
+}

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/PerfectResolver.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/PerfectResolver.java?rev=1198869&r1=1198868&r2=1198869&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/PerfectResolver.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/resolver/PerfectResolver.java Mon Nov  7 18:48:25 2011
@@ -15,31 +15,31 @@
  * limitations under the License.
  */
 
-package opennlp.tools.coref.resolver;
-
+package opennlp.tools.coref.resolver;
+
 import opennlp.tools.coref.DiscourseEntity;
 import opennlp.tools.coref.DiscourseModel;
 import opennlp.tools.coref.mention.MentionContext;
-
-/**
- * Resolver used in training to update the discourse model based on the coreference annotation.
- */
-public class PerfectResolver extends  AbstractResolver {
-
-  public PerfectResolver() {
-    super(0);
-  }
-
-  public boolean canResolve(MentionContext ec) {
-    return true;
-  }
-
+
+/**
+ * Resolver used in training to update the discourse model based on the coreference annotation.
+ */
+public class PerfectResolver extends  AbstractResolver {
+
+  public PerfectResolver() {
+    super(0);
+  }
+
+  public boolean canResolve(MentionContext ec) {
+    return true;
+  }
+
   @Override
-  protected boolean outOfRange(MentionContext ec, DiscourseEntity de) {
-    return false;
-  }
-
-  public DiscourseEntity resolve(MentionContext ec, DiscourseModel dm) {
-    return null;
-  }
-}
+  protected boolean outOfRange(MentionContext ec, DiscourseEntity de) {
+    return false;
+  }
+
+  public DiscourseEntity resolve(MentionContext ec, DiscourseModel dm) {
+    return null;
+  }
+}

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/sim/NumberEnum.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/sim/NumberEnum.java?rev=1198869&r1=1198868&r2=1198869&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/sim/NumberEnum.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/coref/sim/NumberEnum.java Mon Nov  7 18:48:25 2011
@@ -15,37 +15,37 @@
  * limitations under the License.
  */
 
-package opennlp.tools.coref.sim;
-
-/**
- * Enumeration of number types.
- */
-public class NumberEnum {
-
+package opennlp.tools.coref.sim;
+
+/**
+ * Enumeration of number types.
+ */
+public class NumberEnum {
+
   private final String name;
-  
+  
   /** 
    * Singular number type. 
-   */
-  public static final NumberEnum SINGULAR = new NumberEnum("singular");
+   */
+  public static final NumberEnum SINGULAR = new NumberEnum("singular");
   
   /** 
    * Plural number type. 
-   */
-  public static final NumberEnum PLURAL = new NumberEnum("plural");
+   */
+  public static final NumberEnum PLURAL = new NumberEnum("plural");
   
   /** 
    * Unknown number type. 
-   */
-  public static final NumberEnum UNKNOWN = new NumberEnum("unknown");
-
-  private NumberEnum(String name) {
-    this.name = name;
-  }
-
+   */
+  public static final NumberEnum UNKNOWN = new NumberEnum("unknown");
+
+  private NumberEnum(String name) {
+    this.name = name;
+  }
+
   @Override
-  public String toString(){
-    return name;
-  }
-
-}
+  public String toString(){
+    return name;
+  }
+
+}