You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by co...@apache.org on 2011/07/21 04:04:28 UTC

svn commit: r1149006 - in /incubator/opennlp/trunk/opennlp-tools/src: main/java/opennlp/tools/dictionary/AbbreviationDictionary.java test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java

Author: colen
Date: Thu Jul 21 02:04:27 2011
New Revision: 1149006

URL: http://svn.apache.org/viewvc?rev=1149006&view=rev
Log:
OPENNLP-234 Abbreviation dictionar should be case sensitive by default.

Modified:
    incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java
    incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java

Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java?rev=1149006&r1=1149005&r2=1149006&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java Thu Jul 21 02:04:27 2011
@@ -93,10 +93,10 @@ public class AbbreviationDictionary exte
   private Set<StringWrapper> entrySet = new HashSet<StringWrapper>();
 
   /**
-   * Initializes an empty case insensitive {@link AbbreviationDictionary}.
+   * Initializes an empty case sensitive {@link AbbreviationDictionary}.
    */
   public AbbreviationDictionary() {
-    this(false);
+    this(true);
   }
 
   /**
@@ -110,7 +110,7 @@ public class AbbreviationDictionary exte
   }
 
   /**
-   * Initializes a case insensitive {@link AbbreviationDictionary} from an existing
+   * Initializes a case sensitive {@link AbbreviationDictionary} from an existing
    * dictionary resource.
    * 
    * @param in
@@ -120,11 +120,11 @@ public class AbbreviationDictionary exte
    */
   public AbbreviationDictionary(InputStream in) throws IOException,
       InvalidFormatException {
-    this(in, false);
+    this(in, true);
   }
 
   /**
-   * Initializes a case insensitive {@link AbbreviationDictionary} from an existing
+   * Initializes a {@link AbbreviationDictionary} from an existing
    * dictionary resource.
    * 
    * @param in

Modified: incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java?rev=1149006&r1=1149005&r2=1149006&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java (original)
+++ incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java Thu Jul 21 02:04:27 2011
@@ -146,7 +146,7 @@ public class AbbreviationDictionaryTest 
     String entry1 = "1a";
     String entry2 = "1A";
 
-    AbbreviationDictionary dict = new AbbreviationDictionary();
+    AbbreviationDictionary dict = new AbbreviationDictionary(false);
 
     dict.add(entry1);
 
@@ -157,7 +157,7 @@ public class AbbreviationDictionaryTest 
    * Tests the lookup of tokens of different case.
    */
   @Test
-  public void testDifferentCaseLookupCaseInsensitive() {
+  public void testDifferentCaseLookupCaseSensitive() {
 
     String entry1 = "1a";
     String entry2 = "1A";



Re: svn commit: r1149006 - in /incubator/opennlp/trunk/opennlp-tools/src: main/java/opennlp/tools/dictionary/AbbreviationDictionary.java test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java

Posted by "william.colen@gmail.com" <wi...@gmail.com>.
On Wed, Jul 20, 2011 at 11:15 PM, James Kosin <ja...@gmail.com> wrote:

> Colen,
>
> Have a closer look at the code on this.  The changes you made seem to
> suggest you want to keep the old behavior for the tests.  What we should
> probably do is go through all the classes that have case sensitivity flags,
> I know there are more, and create two classes for each test.  One created
> with case (true) and the other with (false) and test both situations with
> expected outcomes.
>
> James
>
>
Thank you for reviewing, James.
Yes, it is a confusing to deal with the flags and creating two classes for
each test would make it easier to understand. We should do that.

In this case I double checked and it looks OK to me, but I'll follow your
suggestion and create two classes. We are not checking other things, like
hashCode and equals, changing the CS flag.

William



>
> On 7/20/2011 10:04 PM, colen@apache.org wrote:
>
>> Author: colen
>> Date: Thu Jul 21 02:04:27 2011
>> New Revision: 1149006
>>
>> URL: http://svn.apache.org/viewvc?**rev=1149006&view=rev<http://svn.apache.org/viewvc?rev=1149006&view=rev>
>> Log:
>> OPENNLP-234 Abbreviation dictionar should be case sensitive by default.
>>
>> Modified:
>>     incubator/opennlp/trunk/**opennlp-tools/src/main/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionary.java
>>     incubator/opennlp/trunk/**opennlp-tools/src/test/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionaryTest.**java
>>
>> Modified: incubator/opennlp/trunk/**opennlp-tools/src/main/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionary.java
>> URL: http://svn.apache.org/viewvc/**incubator/opennlp/trunk/**
>> opennlp-tools/src/main/java/**opennlp/tools/dictionary/**
>> AbbreviationDictionary.java?**rev=1149006&r1=1149005&r2=**
>> 1149006&view=diff<http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java?rev=1149006&r1=1149005&r2=1149006&view=diff>
>> ==============================**==============================**
>> ==================
>> --- incubator/opennlp/trunk/**opennlp-tools/src/main/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionary.java (original)
>> +++ incubator/opennlp/trunk/**opennlp-tools/src/main/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionary.java Thu Jul 21
>> 02:04:27 2011
>> @@ -93,10 +93,10 @@ public class AbbreviationDictionary exte
>>    private Set<StringWrapper>  entrySet = new HashSet<StringWrapper>();
>>
>>    /**
>> -   * Initializes an empty case insensitive {@link
>> AbbreviationDictionary}.
>> +   * Initializes an empty case sensitive {@link AbbreviationDictionary}.
>>     */
>>    public AbbreviationDictionary() {
>> -    this(false);
>> +    this(true);
>>    }
>>
>>    /**
>> @@ -110,7 +110,7 @@ public class AbbreviationDictionary exte
>>    }
>>
>>    /**
>> -   * Initializes a case insensitive {@link AbbreviationDictionary} from
>> an existing
>> +   * Initializes a case sensitive {@link AbbreviationDictionary} from an
>> existing
>>     * dictionary resource.
>>     *
>>     * @param in
>> @@ -120,11 +120,11 @@ public class AbbreviationDictionary exte
>>     */
>>    public AbbreviationDictionary(**InputStream in) throws IOException,
>>        InvalidFormatException {
>> -    this(in, false);
>> +    this(in, true);
>>    }
>>
>>    /**
>> -   * Initializes a case insensitive {@link AbbreviationDictionary} from
>> an existing
>> +   * Initializes a {@link AbbreviationDictionary} from an existing
>>     * dictionary resource.
>>     *
>>     * @param in
>>
>> Modified: incubator/opennlp/trunk/**opennlp-tools/src/test/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionaryTest.**java
>> URL: http://svn.apache.org/viewvc/**incubator/opennlp/trunk/**
>> opennlp-tools/src/test/java/**opennlp/tools/dictionary/**
>> AbbreviationDictionaryTest.**java?rev=1149006&r1=1149005&**
>> r2=1149006&view=diff<http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java?rev=1149006&r1=1149005&r2=1149006&view=diff>
>> ==============================**==============================**
>> ==================
>> --- incubator/opennlp/trunk/**opennlp-tools/src/test/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionaryTest.**java (original)
>> +++ incubator/opennlp/trunk/**opennlp-tools/src/test/java/**
>> opennlp/tools/dictionary/**AbbreviationDictionaryTest.**java Thu Jul 21
>> 02:04:27 2011
>> @@ -146,7 +146,7 @@ public class AbbreviationDictionaryTest
>>      String entry1 = "1a";
>>      String entry2 = "1A";
>>
>> -    AbbreviationDictionary dict = new AbbreviationDictionary();
>> +    AbbreviationDictionary dict = new AbbreviationDictionary(false);
>>
>>      dict.add(entry1);
>>
>> @@ -157,7 +157,7 @@ public class AbbreviationDictionaryTest
>>     * Tests the lookup of tokens of different case.
>>     */
>>    @Test
>> -  public void testDifferentCaseLookupCaseIns**ensitive() {
>> +  public void testDifferentCaseLookupCaseSen**sitive() {
>>
>>      String entry1 = "1a";
>>      String entry2 = "1A";
>>
>>
>>
>

Re: svn commit: r1149006 - in /incubator/opennlp/trunk/opennlp-tools/src: main/java/opennlp/tools/dictionary/AbbreviationDictionary.java test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java

Posted by James Kosin <ja...@gmail.com>.
Colen,

Have a closer look at the code on this.  The changes you made seem to 
suggest you want to keep the old behavior for the tests.  What we should 
probably do is go through all the classes that have case sensitivity 
flags, I know there are more, and create two classes for each test.  One 
created with case (true) and the other with (false) and test both 
situations with expected outcomes.

James

On 7/20/2011 10:04 PM, colen@apache.org wrote:
> Author: colen
> Date: Thu Jul 21 02:04:27 2011
> New Revision: 1149006
>
> URL: http://svn.apache.org/viewvc?rev=1149006&view=rev
> Log:
> OPENNLP-234 Abbreviation dictionar should be case sensitive by default.
>
> Modified:
>      incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java
>      incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java
>
> Modified: incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java
> URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java?rev=1149006&r1=1149005&r2=1149006&view=diff
> ==============================================================================
> --- incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java (original)
> +++ incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/dictionary/AbbreviationDictionary.java Thu Jul 21 02:04:27 2011
> @@ -93,10 +93,10 @@ public class AbbreviationDictionary exte
>     private Set<StringWrapper>  entrySet = new HashSet<StringWrapper>();
>
>     /**
> -   * Initializes an empty case insensitive {@link AbbreviationDictionary}.
> +   * Initializes an empty case sensitive {@link AbbreviationDictionary}.
>      */
>     public AbbreviationDictionary() {
> -    this(false);
> +    this(true);
>     }
>
>     /**
> @@ -110,7 +110,7 @@ public class AbbreviationDictionary exte
>     }
>
>     /**
> -   * Initializes a case insensitive {@link AbbreviationDictionary} from an existing
> +   * Initializes a case sensitive {@link AbbreviationDictionary} from an existing
>      * dictionary resource.
>      *
>      * @param in
> @@ -120,11 +120,11 @@ public class AbbreviationDictionary exte
>      */
>     public AbbreviationDictionary(InputStream in) throws IOException,
>         InvalidFormatException {
> -    this(in, false);
> +    this(in, true);
>     }
>
>     /**
> -   * Initializes a case insensitive {@link AbbreviationDictionary} from an existing
> +   * Initializes a {@link AbbreviationDictionary} from an existing
>      * dictionary resource.
>      *
>      * @param in
>
> Modified: incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java
> URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java?rev=1149006&r1=1149005&r2=1149006&view=diff
> ==============================================================================
> --- incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java (original)
> +++ incubator/opennlp/trunk/opennlp-tools/src/test/java/opennlp/tools/dictionary/AbbreviationDictionaryTest.java Thu Jul 21 02:04:27 2011
> @@ -146,7 +146,7 @@ public class AbbreviationDictionaryTest
>       String entry1 = "1a";
>       String entry2 = "1A";
>
> -    AbbreviationDictionary dict = new AbbreviationDictionary();
> +    AbbreviationDictionary dict = new AbbreviationDictionary(false);
>
>       dict.add(entry1);
>
> @@ -157,7 +157,7 @@ public class AbbreviationDictionaryTest
>      * Tests the lookup of tokens of different case.
>      */
>     @Test
> -  public void testDifferentCaseLookupCaseInsensitive() {
> +  public void testDifferentCaseLookupCaseSensitive() {
>
>       String entry1 = "1a";
>       String entry2 = "1A";
>
>