-2

I'm trying to identify random strings from list of strings in python, I want to read each word and be able to say if it is random or if it is a meaningful word.The words could be formed by english characters and also programmatically meaningful words like com, java, python etc should be identified.

Other than storing all the english words in a file and comparing them, are there any solution or existing code library already present ?

I know there aren't easy ways to find randomness , any other simple methods or suggestions are also welcome.

ex - rrstm asdfsa qmquas

Thanks in advance

user3826306
  • 336
  • 1
  • 5
  • 16
  • [`PyEnchant`](http://pythonhosted.org/pyenchant/) – miradulo Mar 30 '15 at 12:48
  • possible duplicate of [How to check if a word is an English word with Python?](http://stackoverflow.com/questions/3788870/how-to-check-if-a-word-is-an-english-word-with-python) – miradulo Mar 30 '15 at 12:50

2 Answers2

2

You can do this using pyenchant.Install it using pip

sudo pip install pyenchant

Then import it.

In [1]: import enchant

In [2]: d = enchant.Dict("en_US")

In [3]: d.check("Hello")
Out[3]: True

In [4]: d.check("Helo")
Out[4]: False
itzMEonTV
  • 19,851
  • 4
  • 39
  • 49
  • But enchant doesn't identify program related words , is there a workaround for this ? ex: >>> d.check("java") False – user3826306 Mar 30 '15 at 13:52
0

You can you use wordnik api for comparing the string and checking whether it returns a meaning or no definition found.

venky
  • 21
  • 4