Comments (9)
Hey @gdude2002 , I understand your concern and I think there should be an option like json=False
added.
Consider this to be added in the next release 👍
from vocabulary.
👍
EDIT: @prodicus Just out of interest, why did you decide to do it this way?
from vocabulary.
So what if(that's a big if) someone would be using this in javascript
and wanted to access the list
being returned? Now I am not sure if you can inherently do that in javascript
but I thought returning JSON
objects would pretty much serve the purpose of delivering the data in a widely usable manner. Leave alone for javascript
.
Now I may be wrong on this, so it would be great if you could share your thoughts on this
Edit Is this appropriate ? http://stackoverflow.com/questions/23038710/accessing-python-list-in-javascript-as-an-array
from vocabulary.
Well, sure, but you're writing a Python library here, not a JavaScript library. What use case do you have for this Python-bound data somehow ending up being used by a JavaScript program, and why can't that program request the data on its own?
Besides, if you are doing that, you can convert it back to JSON when you need it to be JSON.
from vocabulary.
You have a point here @gdude2002 . So would returning a list
be a good idea? Or a dict
?
Edit How would you suggest structuring the data to be returned?
from vocabulary.
Whichever would be more appropriate for the data you're returning, yes. Most (valid) JSON data will translate directly to Python dicts, but there's no reason you can't clean them up a little before returning if you so wish.
from vocabulary.
I feel that list
's would be good here (wordnet style).
So instead of
>>> vb.meaning("levitate")
'[{"text": "(intransitive) Be suspended in the air, as if in defiance of gravity.", "seq": 0}, {"text": "(transitive) To cause to rise in the air and float, as if in defiance of gravity.", "seq": 1}]'
>>>
it would return
>>> vb.meaning("levitate")
["(intransitive) Be suspended in the air, as if in defiance of gravity.", "(transitive) To cause to rise in the air and float, as if in defiance of gravity."]
>>>
when json=False
What do you think ?
from vocabulary.
Yeah, that makes sense to me.
from vocabulary.
Closed by 7573f21.
feel free to reopen it again if not the case @gdude2002
from vocabulary.
Related Issues (20)
- Blazing fast, but a significant issue HOT 1
- Return False always HOT 1
- [Problems] Inconsistent data HOT 6
- Use nose for finding tests
- docs autogeneration HOT 1
- Initial Update
- Installation issues on Mac HOT 1
- Installation issue on Ubuntu 16.04 HOT 5
- using Antonym gives an error "Connection Lost False" HOT 2
- Ignore Case of Word When Searching Part of Speech
- Unusual docstring format HOT 8
- timeouts HOT 2
- A lot of duplicates from meaning() HOT 3
- usage_example issue HOT 3
- Rate Limit? HOT 1
- Need for automation to release to pypi
- Module not working HOT 1
- Odd requirements.txt HOT 4
- vb.meaning('repudiate') returns false HOT 13
- Contribute more backends, extend API HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vocabulary.