I have a word lets say "Racing".
I want to know all its formats nouns, adjectives verbs etc. For eg. Race racer races etc.
Is there a python library that can help me out with this?
I have a word lets say "Racing".
I want to know all its formats nouns, adjectives verbs etc. For eg. Race racer races etc.
Is there a python library that can help me out with this?
if you're interested in matching these strings, I'd recommend looking at fuzzywuzzy. It allows you to easily tokenize strings and match based on token equivalence within a certain tolerance.
For example 'Race' and 'Racer' would have a high matching percentage of tokens and could be considered match.
As far as extrapolating different forms of a word, I'm afraid I've never seen something canned, although this could very well help toward your goal, and perhaps provide you the right starting place for writing your own.
I hope this helps
I found similar question Convert words between verb/noun/adjective forms
In one of the answers user @PBelzile suggests online service Idilia: http://www.idilia.com/demos/language-graph-browser/?node=code%2FV3
Looks like it can do what you want.
Also you can try nltk with wordnet:
import nltk
nltk.download("wordnet")
from nltk.corpus import wordnet as wn
for lemma in wn.lemmas("race"):
for form in lemma.derivationally_related_forms():
print lemma, form
Outputs:
Lemma('race.n.01.race') Lemma('race.v.02.race')
Lemma('race.n.02.race') Lemma('race.v.02.race')
Lemma('race.n.02.race') Lemma('racy.s.04.racy')
Lemma('race.n.03.race') Lemma('racial.a.01.racial')
Lemma('race.v.02.race') Lemma('racing.n.01.racing')
Lemma('race.v.02.race') Lemma('race.n.02.race')
Lemma('race.v.02.race') Lemma('racer.n.03.racer')
Lemma('race.v.02.race') Lemma('racer.n.02.racer')
Lemma('race.v.02.race') Lemma('race.n.01.race')
Lemma('race.v.04.race') Lemma('racer.n.01.racer')