Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
Ok I investigated a bit further and I found some seriously weird 
stuff...I'm gonna need the help of a java expert here:


(pprint (.getMethods (.getClass opennlp-pos)))  ;;notice that the method 
I'm trying to call *doesn't exist according to this*


[#Method public static opennlp.tools.postag.POSModel 
opennlp.tools.postag.POSTaggerME.train(java.lang.String,opennlp.tools.util.ObjectStream,opennlp.tools.util.model.ModelType,opennlp.tools.postag.POSDictionary,opennlp.tools.dictionary.Dictionary,int,int) 
throws java.io.IOException,

 #Method public void opennlp.tools.postag.POSTaggerME.probs(double[]),
 #Method public double[] opennlp.tools.postag.POSTaggerME.probs(),
 #Method public int opennlp.tools.postag.POSTaggerME.getNumTags(),
 #Method public java.lang.String[] 
opennlp.tools.postag.POSTaggerME.getOrderedTags(java.util.List,java.util.List,int),
 #Method public java.lang.String[] 
opennlp.tools.postag.POSTaggerME.getOrderedTags(java.util.List,java.util.List,int,double[]),
 #Method public opennlp.tools.util.Sequence[] 
opennlp.tools.postag.POSTaggerME.topKSequences(java.util.List),
 #Method public opennlp.tools.util.Sequence[] 
opennlp.tools.postag.POSTaggerME.topKSequences(java.lang.String[]),
*#Method public java.lang.String[] 
opennlp.tools.postag.POSTaggerME.tag(java.lang.String[]),**
** #Method public java.lang.String 
opennlp.tools.postag.POSTaggerME.tag(java.lang.String),**
** #Method public java.util.List 
opennlp.tools.postag.POSTaggerME.tag(java.util.List),**
** #Method public java.lang.String[][] 
opennlp.tools.postag.POSTaggerME.tag(int,java.lang.String[]),*
 #Method public final void java.lang.Object.wait(long,int) throws 
java.lang.InterruptedException,
 #Method public final native void java.lang.Object.wait(long) throws 
java.lang.InterruptedException,
 #Method public final void java.lang.Object.wait() throws 
java.lang.InterruptedException,

 #Method public boolean java.lang.Object.equals(java.lang.Object),
 #Method public java.lang.String java.lang.Object.toString(),
 #Method public native int java.lang.Object.hashCode(),
 #Method public final native java.lang.Class java.lang.Object.getClass(),
 #Method public final native void java.lang.Object.notify(),
 #Method public final native void java.lang.Object.notifyAll()]
nil

but then this seems very strange so I went and decompiled the class file 
(actually the entire jar) and the method that takes 2 arrays as args 
does exist both in the interface and the concrete implementation 
(POSTagger  POSTaggerME respectively)


how on earth can that be? any ideas anyone? this seems utterly odd to me!

Jim


On 12/03/13 13:26, Jim - FooBar(); wrote:

Hi all,

I came back to a project of mine after a week or so and I'm facing a 
problem which I have no idea where it came from! This is the first 
time I'm seeing it on this project - everything worked just fine a 
week ago! The problem is this:


Consider some java class (opennlp-POS-tagger) with 3 .tag() 
overloads...signatures and bodies follow:


public *String[] tag(String[] sentence)* {
return this.tag(sentence, null); //this is essentially what I'm 
trying in my code

  }

  public *String[] tag(String[] sentence, Object[] additionaContext) *{
bestSequence = beam.bestSequence(sentence, additionaContext);
ListString t = bestSequence.getOutcomes();
return t.toArray(new String[t.size()]);
  }


  public *String[][] tag(int numTaggings, String[] sentence) *{
Sequence[] bestSequences = beam.bestSequences(numTaggings, 
sentence,null);

String[][] tags = new String[bestSequences.length][];
for (int si=0;sitags.length;si++) {
  ListString t = bestSequences[si].getOutcomes();
  tags[si] = t.toArray(new String[t.size()]);
}


Now, from my code I'm trying to do:

(.tag opennlp-pos (into-array  [New-York (NY) is the city 
that never sleeps .]) nil)


which gives me a IllegalArgumentException Unexpected param type, 
expected: int, given: [Ljava.lang.String; 
clojure.lang.Reflector.boxArg (Reflector.java:432)
Basically, it's trying to invoke the last overload ,whereas I'm trying 
to invoke the second one!!!


If I omit the 'nil' at the end , the correct method is invoked (the 
first which calls the second)...why can't Clojure find the second 
overload and goes for the 3rd?


any ideas?

Jim




--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit 

Re: strange interop behaviour/issue

2013-03-12 Thread Marko Topolnik
What explains the occurrence of these extra signatures that you don't 
mention above? It's hard to answer without having the full picture.

On Tuesday, March 12, 2013 2:52:19 PM UTC+1, Jim foo.bar wrote:

  Ok I investigated a bit further and I found some seriously weird 
 stuff...I'm gonna need the help of a java expert here:

 (pprint (.getMethods (.getClass opennlp-pos)))  ;;notice that the method 
 I'm trying to call *doesn't exist according to this*

 [..., 

 *#Method public java.lang.String[] 
 opennlp.tools.postag.POSTaggerME.tag(java.lang.String[]),**
 ** #Method public java.lang.String 
 opennlp.tools.postag.POSTaggerME.tag(java.lang.String),**
 ** #Method public java.util.List 
 opennlp.tools.postag.POSTaggerME.tag(java.util.List),**
 ** #Method public java.lang.String[][] 
 opennlp.tools.postag.POSTaggerME.tag(int,java.lang.String[]),*

... 

 ]
 nil

 but then this seems very strange so I went and decompiled the class file 
 (actually the entire jar) and the method that takes 2 arrays as args does 
 exist both in the interface and the concrete implementation (POSTagger  
 POSTaggerME respectively)

 how on earth can that be? any ideas anyone? this seems utterly odd to me!
  

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();

On 12/03/13 14:31, Marko Topolnik wrote:
What explains the occurrence of these extra signatures that you don't 
mention above? It's hard to answer without having the full picture.


they are deprecated...there are 5 .tag() overloads in total. 2 of them 
are deprecated (the one accepting List and the one accepting 
String)...the other 3 are ok but I'm missing one (the one taking 2 
arrays)! I just discovered there is another one missing (the 
topKSequences taking 2 arrays)!!!


the full picture is that 2 separate overloads don't show when calling 
getMethods()/getDeclaredMethods() even though they are both public! 
Having decompiled the jar I can confirm that the 2 methods are indeed 
present! In fact I was using them a week ago! I'm at a loss here...any 
help will be greatly appreciated...


Jim

--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread David Powell
It looks like:

public String[] tag(String[] sentence, Object[] additionaContext);

wasn't originally present in the API, and was added in:

http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177

It sounds like you might have more than one version of the class on your
classpath perhaps, or at least aren't using the code you think you're using?




On Tue, Mar 12, 2013 at 2:38 PM, Jim - FooBar(); jimpil1...@gmail.comwrote:

 On 12/03/13 14:31, Marko Topolnik wrote:

 What explains the occurrence of these extra signatures that you don't
 mention above? It's hard to answer without having the full picture.


 they are deprecated...there are 5 .tag() overloads in total. 2 of them are
 deprecated (the one accepting List and the one accepting String)...the
 other 3 are ok but I'm missing one (the one taking 2 arrays)! I just
 discovered there is another one missing (the topKSequences taking 2
 arrays)!!!

 the full picture is that 2 separate overloads don't show when calling
 getMethods()/**getDeclaredMethods() even though they are both public!
 Having decompiled the jar I can confirm that the 2 methods are indeed
 present! In fact I was using them a week ago! I'm at a loss here...any help
 will be greatly appreciated...

 Jim


 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en
 --- You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to 
 clojure+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
that is a reasonable thought indeed but it is extremely unlikely that 
something like this is happening...the version of opennlp I'm using is 
my own home-brewed one which I've manually installed in my  local-repo 
for sometime now...in my project.clj the dependency looks like this: 
[experiment/experiment 1.5.3]


the source of that jar is still on my eclipse workspace which I can 
consult very quickly...in addition I threw the jar in the JD decompiler 
and after poking around I did find the methods...


however some other lib may be pulling in openNLP...give me 2 sec I'll 
get back to you...


Jim




On 12/03/13 14:49, David Powell wrote:

It looks like:

public String[] tag(String[] sentence, Object[] additionaContext);

wasn't originally present in the API, and was added in:

http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177

It sounds like you might have more than one version of the class on 
your classpath perhaps, or at least aren't using the code you think 
you're using?





On Tue, Mar 12, 2013 at 2:38 PM, Jim - FooBar(); jimpil1...@gmail.com 
mailto:jimpil1...@gmail.com wrote:


On 12/03/13 14:31, Marko Topolnik wrote:

What explains the occurrence of these extra signatures that
you don't mention above? It's hard to answer without having
the full picture.


they are deprecated...there are 5 .tag() overloads in total. 2 of
them are deprecated (the one accepting List and the one accepting
String)...the other 3 are ok but I'm missing one (the one taking 2
arrays)! I just discovered there is another one missing (the
topKSequences taking 2 arrays)!!!

the full picture is that 2 separate overloads don't show when
calling getMethods()/getDeclaredMethods() even though they are
both public! Having decompiled the jar I can confirm that the 2
methods are indeed present! In fact I was using them a week ago!
I'm at a loss here...any help will be greatly appreciated...

Jim


-- 
-- 
You received this message because you are subscribed to the Google

Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
mailto:clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
mailto:clojure%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the
Google Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
mailto:clojure%2bunsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient 
with your first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
David you are a genious!!! thank you thank you very much!!! one of my 
dependencies was pulling in opennlp/tools 1.5.0 which is a 2 year old jar!!!


added :exclusions and now I'm back in the game

If you're in Manchester Uk I'm buying beer... :)

Jim


On 12/03/13 14:49, David Powell wrote:

It looks like:

public String[] tag(String[] sentence, Object[] additionaContext);

wasn't originally present in the API, and was added in:

http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag/POSTaggerME.java?r1=1245855r2=1294177

It sounds like you might have more than one version of the class on 
your classpath perhaps, or at least aren't using the code you think 
you're using?





On Tue, Mar 12, 2013 at 2:38 PM, Jim - FooBar(); jimpil1...@gmail.com 
mailto:jimpil1...@gmail.com wrote:


On 12/03/13 14:31, Marko Topolnik wrote:

What explains the occurrence of these extra signatures that
you don't mention above? It's hard to answer without having
the full picture.


they are deprecated...there are 5 .tag() overloads in total. 2 of
them are deprecated (the one accepting List and the one accepting
String)...the other 3 are ok but I'm missing one (the one taking 2
arrays)! I just discovered there is another one missing (the
topKSequences taking 2 arrays)!!!

the full picture is that 2 separate overloads don't show when
calling getMethods()/getDeclaredMethods() even though they are
both public! Having decompiled the jar I can confirm that the 2
methods are indeed present! In fact I was using them a week ago!
I'm at a loss here...any help will be greatly appreciated...

Jim


-- 
-- 
You received this message because you are subscribed to the Google

Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
mailto:clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
mailto:clojure%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the
Google Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
mailto:clojure%2bunsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient 
with your first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups Clojure group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.