You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by Joern Kottmann <ko...@gmail.com> on 2012/02/10 09:07:29 UTC
Re: svn commit: r1242524 - /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
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, <co...@apache.org> 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
>
>
>
Re: svn commit: r1242524 - /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
Posted by Joern Kottmann <ko...@gmail.com>.
+1
Jörn
On Fri, Feb 10, 2012 at 10:38 AM, Aliaksandr Autayeu <aliaksandr@autayeu.com
> wrote:
> 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 <ko...@gmail.com>
> 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, <co...@apache.org> 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
> > >
> > >
> > >
> >
>
Re: svn commit: r1242524 - /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSDictionary.java
Posted by Aliaksandr Autayeu <al...@autayeu.com>.
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 <ko...@gmail.com> 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, <co...@apache.org> 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
> >
> >
> >
>