Adding -ing to multi-syllable words

171 views
Skip to first unread message

Ian Perera

unread,
Jul 12, 2010, 5:21:58 PM7/12/10
to nltk-users
Hi everyone,

Is there some way I could generate the -ing form of a verb through
NLTK or some other Python library? It seems all of NLTK's stemming
tools are devoted to getting the stem of a word, not adding to it. I
can use some basic grammar rules for single syllable words, but with
multiple syllable words, you need to know the stress of the word to
create the correct ending.

I thought of simply using naive rules and running the words through a
spell checker, but then I had the problem of finding a good spell
checker :/

Thanks for your help,
Ian

Jacob Perkins

unread,
Jul 13, 2010, 12:26:28 PM7/13/10
to nltk-users
Hi Ian,

Not sure if this will work, but it might be possible to look at the
previous part-of-speech tags to determine whether the next word should
have -ing.

As for spell checking, I'd recommend looking at http://www.rfk.id.au/software/pyenchant/
I've used it in combination with nltk.metrics.edit_distance with
pretty good results.

Jacob
---
http://streamhacker.com
http://twitter.com/japerk

Ian Perera

unread,
Jul 13, 2010, 6:24:16 PM7/13/10
to nltk-users
Thanks, I'll check PyEnchant out, it should help. I already know the
words need an -ing (I'm just adding the -ing to verbs so that I can
look them up in Wikipedia to get the wiki page for a particular
action).

Ian

On Jul 13, 12:26 pm, Jacob Perkins <jap...@gmail.com> wrote:
> Hi Ian,
>
> Not sure if this will work, but it might be possible to look at the
> previous part-of-speech tags to determine whether the next word should
> have -ing.
>
> As for spell checking, I'd recommend looking athttp://www.rfk.id.au/software/pyenchant/
> I've used it in combination with nltk.metrics.edit_distance with
> pretty good results.
>
> Jacob
> ---http://streamhacker.comhttp://twitter.com/japerk

Richard Careaga

unread,
Jul 13, 2010, 8:17:44 PM7/13/10
to nltk-...@googlegroups.com
All but one of the English rules for adding -ing are fairly simple:

# http://netgrammar.altec.org/Support/a101b3_101000.html#ing

yank = 1
verblist = []
ing = 'ing'
ying = 'ying'
xwy = ['x','w','y']
l = ['l']
e = ['e']
ie = ['i','e']
vowel = ['a','e','i','o','u','y']

results = []

for verb in verblist:
    if #[left as an exercise for the reader]:
    '''the simple form of a verb with two or more syllables ends in a single vowel + consonant, double the final consonant only if the stress is on the final syllable.'''
    elif verb[-1] in xwy:
        gerund = verb+ing
        results.append(gerund)
    elif verb[-1] in l:
        if yank:
            gerund = verb+ing
            results.append(gerund)
        else:
            gerund = verb+l[-1]+ing
            results.append(gerund)
    elif verb[-2] in vowel and verb[-1] not in vowel:
        gerund = verb+l[-1]+ing
        results.append(gerund)
    elif verb[-2] in ie and verb[-1] in ie:
        gerund = verb+ying
        results.append(gerund)
    elif verb[-1] in e:
        gerund = verb+ing
        results.append(gerund)
    else:
        gerund = verb+ing
        results.append(gerund)

Ian Perera

unread,
Jul 23, 2010, 10:14:00 AM7/23/10
to nltk-users
Yeah, that one non-simple one is the problem for me. I have no way of
finding the stress of a word through Python (do I?), so I can't
implement that feature. I think the best I can do is use the other
rules and then spellcheck, but even that won't be fool-proof.

Thanks,
Ian

On Jul 13, 8:17 pm, Richard Careaga <leuc...@gmail.com> wrote:
> All but one of the English rules for adding -ing are fairly simple:
>
> #http://netgrammar.altec.org/Support/a101b3_101000.html#ing

Lucien

unread,
Jul 23, 2010, 11:43:31 AM7/23/10
to nltk-...@googlegroups.com
Hi,

The stress information can be found in cmudict (and there is an nltk
corpus reader for that). Of course it will also have the -ing forms of
any normal verb.

~Lucien

> --
> You received this message because you are subscribed to the Google Groups "nltk-users" group.
> To post to this group, send email to nltk-...@googlegroups.com.
> To unsubscribe from this group, send email to nltk-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nltk-users?hl=en.
>
>

--
I trace a stream up till it ends,
and sit to watch the rising mist.

Reply all
Reply to author
Forward
0 new messages