I agree, showing first three items only will cost you a lot of time during
debug, because it distorts reality. Probably the number of items and case
flag will do the job. May be items=[...] or items=<...> might indicate the
presence of multiple entries clearly enough.

Aliaksandr

On Fri, Feb 10, 2012 at 9:07 AM, Joern Kottmann <[email protected]> wrote:

> Hello,
>
> that is not how toString should be implemented here.
> Just showing the first three entries doesn't really has any value
> and might be highly confusing during debugging.
>
> I see your point that doesn't really make sense to look at a
> long dictionary dump in a debugger.
>
> Maybe we should just print out some information about the dictionary?
> E.g. its size and if its case sensitive or not.
>
> Jörn
>
> On Thu, Feb 9, 2012 at 10:11 PM, <[email protected]> wrote:
>
> > Author: colen
> > Date: Thu Feb  9 21:11:12 2012
> > New Revision: 1242524
> >
> > URL: http://svn.apache.org/viewvc?rev=1242524&view=rev
> > Log:
> > OPENNLP-431: Modified the toString method to stop after a few entries
> >
> > Modified:
> >
> >
>  
> incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
> >
> > Modified:
> >
> incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java?rev=1242524&r1=1242523&r2=1242524&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
> > (original)
> > +++
> >
> incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
> > Thu Feb  9 21:11:12 2012
> > @@ -262,9 +262,15 @@ public class POSDictionary implements It
> >   public String toString() {
> >     StringBuilder dictionaryString = new StringBuilder();
> >
> > +    int count = 0;
> >     for (String word : dictionary.keySet()) {
> >       dictionaryString.append(word).append(" ->
> > ").append(tagsToString(getTags(word)));
> >       dictionaryString.append("\n");
> > +      if (count++ > 3) {
> > +        // lets stop now because it takes a lot of time if we are
> working
> > +        // with a big dictionary
> > +        break;
> > +      }
> >     }
> >
> >     // remove last new line
> >
> >
> >
>

Reply via email to