Revision: 17366
          http://sourceforge.net/p/gate/code/17366
Author:   adamfunk
Date:     2014-02-20 14:06:05 +0000 (Thu, 20 Feb 2014)
Log Message:
-----------
Adding a 'close enough match' test to be used in the DF resource later.

Modified Paths:
--------------
    gate/trunk/plugins/TermRaider/src/gate/termraider/util/Term.java

Modified: gate/trunk/plugins/TermRaider/src/gate/termraider/util/Term.java
===================================================================
--- gate/trunk/plugins/TermRaider/src/gate/termraider/util/Term.java    
2014-02-20 13:58:17 UTC (rev 17365)
+++ gate/trunk/plugins/TermRaider/src/gate/termraider/util/Term.java    
2014-02-20 14:06:05 UTC (rev 17366)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2010--2012, The University of Sheffield. See the file
+ *  Copyright (c) 2010--2014, The University of Sheffield. See the file
  *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
  *
  *  This file is part of GATE (see http://gate.ac.uk/), and is free
@@ -88,7 +88,32 @@
     return hashCode;
   }
   
+
+  /**
+   * To determine whether a match from a DF table is usable.
+   * Type and string must match; language code is ignored if either
+   * is blank, but must match if both are non-blank.
+   * @param other
+   * @return
+   */
+  public boolean closeMatch(Term other) {
+    if (! this.termString.equals(other.termString)) {
+      return false;
+    }
+    
+    if (! this.type.equals(other.type)) {
+      return false;
+    }
+    
+    if ("".equals(this.languageCode) || "".equals(other.languageCode) ) {
+      return true;
+    }
+    
+    return this.languageCode.equals(other.languageCode);
+  }
   
+  
+  
   /**
    * This is used for alphabetical sorting.  The Term instance
    * does not know what its score is.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to