Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Alchemy API does not support standard characters #64

Closed
scprotz opened this issue Sep 25, 2015 · 14 comments
Closed

New Alchemy API does not support standard characters #64

scprotz opened this issue Sep 25, 2015 · 14 comments
Assignees
Milestone

Comments

@scprotz
Copy link

scprotz commented Sep 25, 2015

I get

{"error":"unsupported-text-language", "code":400}

when running text that has characters like & in them.

I think we either need a definition of supported characters or some automated encoding in the method:

service.getEntities()
@scprotz
Copy link
Author

scprotz commented Sep 25, 2015

Some other characters that cause it to break: -and /.

@germanattanasio
Copy link
Contributor

I can reproduce the issue.. seems to be something related to how we encode the form-urlencoded.

@germanattanasio germanattanasio mentioned this issue Oct 12, 2015
6 tasks
@germanattanasio germanattanasio added this to the v2.0.0 milestone Oct 12, 2015
@germanattanasio
Copy link
Contributor

I've added test cases and I think the problem is fixed.
Example:

AlchemyLanguage service = new AlchemyLanguage();

Map<String, Object> params = new HashMap<String, Object>();
String text = "Mr. Vice President, my old colleague from Massachusetts"+
"and your new Speaker & John McCormack, Members of the 87th Congress, "+
"ladies and gentlemen: -. *&^%$#@!@#$%^&*()";
params.put(AlchemyLanguage.TEXT, text);

Entities entities = service.getEntities(params);
Assert.assertNotNull(entities);
Assert.assertFalse(entities.getEntities().isEmpty());

@gcolmen
Copy link

gcolmen commented Feb 18, 2016

Hello, I know it's a closed issue, but I'm using this simple phrase (without any symbols):
"delete laboratory record"

And I'm getting the very same error. What could it be? Or how can I solve it?

Thanks in advance!

@tanmayb123
Copy link
Contributor

Hi! I'm also getting the same issue. This is when I use "Stephen Hillenburg". Is there a way I can specify that the input is in english? Thanks!
EDIT: It also gives the same issue when testing "Scarlett Johansson"

@germanattanasio germanattanasio modified the milestones: 2.10.0, v2.0.0 Apr 6, 2016
@gcolmen
Copy link

gcolmen commented Apr 7, 2016

Hi, I solved the problem by sending a parameter for the language when making the call:

params.put("language", "english");

(params is the Map containing the parameters for the call).

Hope it's useful.

gc

@tanmayb123
Copy link
Contributor

Thanks for the info, @gcolmen!
I was able to use this to create #226

@tanmayb123
Copy link
Contributor

I think we can close the issue now.

@germanattanasio
Copy link
Contributor

I'm going to wait until the next release which is on April 15.

@ghost
Copy link

ghost commented May 8, 2016

How we can set language as "English" when making "alchemyObj.TextGetTaxonomy(str)" call to alchemy?
I'm getting error: "unsupported-text-language" when input is: "Factorial factorial carrot"
Please help.

germanattanasio added a commit that referenced this issue May 9, 2016
@germanattanasio
Copy link
Contributor

AlchemyLanguage service = new AlchemyLanguage();
service.setLanguage(LanguageSelection.ENGLISH)
service.taxonomy("type string here")

@ghost
Copy link

ghost commented May 9, 2016

@germanattanasio: Thank you for this. I've already setup my code which is using Document doc = alchemyObj.TextGetTaxonomy("my string") where "alchemyObj" is of class "com.alchemyapi.api.AlchemyAPI"

Could you please tell where to set Language in this case ?

Thanks!!

@germanattanasio
Copy link
Contributor

@shmarzooq you are using a different SDK. Look at the README.md in this project and switch to use this SDK.

@ghost
Copy link

ghost commented May 9, 2016

@germanattanasio Thank you for pointing it out. I will look into README.md and will see how the switching goes. I just don't want to redo the whole code again. I've almost finished my project using AlchemyAPI (calling AlchemyAPI, passing string, getting text-taxonomies, text-concepts, and parsing the returned XML). Just getting this language issue and rest it's working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants