• This repository has been archived on 18/Aug/2020
  • Stars
    star
    558
  • Rank 79,265 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 9 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[Not Maintained anymore] Python Module to get Meanings, Synonyms and what not for a given word

1   Vocabulary

PyPI version License Python Versions Build Status Requirements Status Join the chat at https://gitter.im/prodicus/vocabulary

A dictionary magician in the form of a module!

Author:Tasdik Rahman

1.1   What is it

[back to top]

For a given word, using Vocabulary, you can get its

  • Meaning
  • Synonyms
  • Antonyms
  • Part of speech : whether the word is a noun, interjection or an adverb et el
  • Translate : Translate a phrase from a source language to the desired language.
  • Usage example : a quick example on how to use the word in a sentence
  • Pronunciation
  • Hyphenation : shows the particular stress points(if any)

1.2   Features

[back to top]

  • Written in uncomplicated Python
  • Returns JSON objects, PYTHON dictionaries and lists
  • Minimum dependencies ( just uses requests module )
  • Easy to install
  • A decent substitute to Wordnet(well almost!) Wanna see? Here is a small comparison
  • Stupidly easy to use
  • Fast!
  • Supports
    • both, python2.* and python3.*
    • Works on Mac, Linux and Windows

1.3   Why should I use Vocabulary

[back to top]

Wordnet is a great resource. No doubt about it! So why should you use Vocabulary when we already have Wordnet out there?

1.3.1   Wordnet Comparison

[back to top]

Let's say you want to find out the synonyms for the word car.

  • Using Wordnet
>>> from nltk.corpus import wordnet
>>> syns = wordnet.synsets('car')
>>> syns[0].lemmas[0].name
'car'
>>> [s.lemmas[0].name for s in syns]
['car', 'car', 'car', 'car', 'cable_car']

>>> [l.name for s in syns for l in s.lemmas]
['car', 'auto', 'automobile', 'machine', 'motorcar', 'car', 'railcar', 'railway_car', 'railroad_car', 'car', 'gondola', 'car', 'elevator_car', 'cable_car', 'car']
  • Doing the same using Vocabulary
>>> from vocabulary.vocabulary import Vocabulary as vb
>>> vb.synonym("car")
'[{
  "seq": 0,
  "text": "automobile"
}, {
  "seq": 1,
  "text": "cart"
}, {
  "seq": 2,
  "text": "automotive"
}, {
  "seq": 3,
  "text": "wagon"
}, {
  "seq": 4,
  "text": "motor"
}]'
>>> ## load the json data
>>> car_synonyms = json.loads(vb.synonym("car"))
>>> type(car_synonyms)
<class 'list'>
>>>

So there you go. You get the data in an easy JSON format.

You can go on comparing for the other methods too.

1.4   Installation

[back to top]

1.4.1   Option 1: installing through pip (Suggested way)

pypi package link

$ pip install vocabulary

If you are behind a proxy

$ pip --proxy [username:password@]domain_name:port install vocabulary

Note: If you get command not found then $ sudo apt-get install python-pip should fix that

1.4.2   Option 2: Installing from source (Only if you must)

$ git clone https://github.com/tasdikrahman/vocabulary.git
$ cd vocabulary/
$ pip install -r requirements.txt
$ python setup.py install

1.4.3   Demo

[back to top]

Demo link
Demo link

1.5   Documentation

[back to top]

For a detailed usage example, refer the documentation at Read the Docs

1.6   Contributing

[back to top]

Please refer Contributing page for details

1.6.1   Discuss

[back to top]

Join us on our Gitter channel if you want to chat or if you have any questions in your mind.

1.6.2   Contributers

[back to top]

  • Huge shoutout to @tenorz007 for adding the ability to return the API response as different data structures.
  • Thanks to Anton Relin for adding the translate module.
  • And a big shout out to all the contributers for their contributions

1.7   Changelog

[back to top]

Please refer Changelog page for details

1.8   Bugs

[back to top]

Please report the bugs at the issue tracker

1.9   Similar

[back to top]

Other similar software inspired by Vocabulary

  • Vocabulary : The Go lang port of this python counterpart
  • woordy : Gives back word translations
  • guile-words : The Guile Scheme port of this python counterpart

1.9.1   Known Issues

[back to top]

  • In python2, when using the method Vocabulary.synonym() or Vocabulary.pronunciation()
>>> vb.synonym("car")
[{
  "seq": 0,
  "text": "automotive"
}, {
  "seq": 1,
  "text": "motor"
}, {
  "seq": 2,
  "text": "wagon"
}, {
  "seq": 3,
  "text": "cart"
}, {
  "seq": 4,
  "text": "automobile"
}]
>>> type(vb.pronunciation("hippopotamus"))
<class 'list'>
>>> json.dumps(vb.pronunciation("hippopotamus"))
'[{"raw": "(h\\u012dp\\u02cc\\u0259-p\\u014ft\\u02c8\\u0259-m\\u0259s)", "rawType": "ahd-legacy", "seq": 0}, {"raw": "HH IH2 P AH0 P AA1 T AH0 M AH0 S", "rawType": "arpabet", "seq": 1}]'
>>>

You are being returned a list object instead of a JSON object. When returning the latter, there are some unicode issues. A fix for this will be released soon.

I may suggest python-ftfy which can help you in this matter.

1.10   License :

[back to top]

Built with by Tasdik Rahman under the MIT License ©

You can find a copy of the License at http://prodicus.mit-license.org/

1.11   Donation

Paypal badge

Instamojo

gratipay

patreon

More Repositories

1

spaceShooter

🎮 The classic retro game recreated using Pygame and python
Python
505
star
2

tnote

📋 A command line note taking app so simple that even your grandparents will love it!
Python
230
star
3

xkcd-dl

⏬ Download ALL xkcd's which have been uploaded till date. Ever!
Python
145
star
4

spammy

Spam filtering made easy for you
Python
140
star
5

plino

Flask based spam filtering system built on top of https://github.com/prodicus/spammy
CSS
74
star
6

terraform-gcp-examples

Terraform Google cloud platform examples
HCL
58
star
7

pyzipcode-cli

📬 Extract all possible meta data using Zipcode
Python
34
star
8

pyCalc

💻 A GUI Calculator using Tkinter
Python
31
star
9

easyrbac

RBAC0 implementation (core part)
Python
30
star
10

markovipy

Yet another markov chain sentence generator
Python
26
star
11

thanos

A dead simple demonstration of SQL injection in an SQLite database
Python
24
star
12

pygame-boilerplate

A dead simple pygame boilerplate
Python
21
star
13

movieReviewsAnalysis

Some stupid Movie reviews analyzed and classified using nltk and scikitlearn
Jupyter Notebook
20
star
14

ansible-bootstrap-server

the bare essentials when you spin up a server
Shell
17
star
15

spamfilter

DEPRECATED: Go to https://github.com/prodicus/spammy for DEV version
Python
14
star
16

bhola

Bhola tells it's overseer on when the certificates tracked by bhola are about to expire
Ruby
13
star
17

opencv_edge_detection

[WIP]
Python
10
star
18

margo

An opinionated Slack bot written for SRMSE's slack channel
Python
9
star
19

dotfiles

🔧
Shell
7
star
20

terraform-google-network

Terraform module : GCP : for creation of VPC network
HCL
5
star
21

cgi_login

a simple login system using CGIHTTPServer and sqlite3
Python
5
star
22

datasets

random public datasets encountered by me
4
star
23

terraform-google-network-subnet

Terraform module : GCP : for creation of subnet inside a VPC network
HCL
4
star
24

web_crawlers

as the name says
Python
3
star
25

foodoh

OUTDATED: Go to https://github.com/foodoh. Made a food recommendor system at Startup Weekend Chennai '15. Named it "foodoh"!
Python
3
star
26

terraform-google-network-firewall

Terraform module : GCP : for creation of firewall rules inside the VPC
HCL
3
star
27

tasdikrahman.me

NOTE: has been moved over to tasdikrahman.com
CSS
2
star
28

tasdikrahman.com

[wip] mirroring tasdikrahman.me for now.
CSS
2
star
29

srm_search_engine

OUTDATED: Head over to https://github.com/SRMSE
Python
2
star
30

opencv3-ansible-vagrant-playbook

Ansible playbook for configuring OpenCV 3.1.0 with python3 on top of a Ubuntu 14.04.05 vagrant box/your preferred cloud service (AWS/DO droplet etc.)
2
star
31

k8s-cluster-upgrade-tool

OSS release of the internal k8s cluster upgrade tooling we have
Go
2
star
32

test-goreleaser

testing goreleaser
Go
1
star
33

shivangidwivedi.com

shivangidwivedi.com
CSS
1
star
34

zshrc

My zshrc
Shell
1
star
35

go-whois

1
star
36

infra

my setup on DO for my homelab on k8s
HCL
1
star
37

btech-major-project-thesis

"Processing textual notes using advanced image processing techniques"
TeX
1
star
38

talks

contains the talks that I have given so far
Python
1
star
39

scripts

This lives in my ~/bin/scripts directory and is added to my $PATH.
1
star
40

docker-flask

Simple example of integrating docker with web apps
Python
1
star
41

kubecon-2017-notes

1
star