Emad Nawfal (عمـ نوفل ـاد) wrote: > Here is the function as I used it, and it works fine: > > def swap(sentence): > buffer = [] > adjectives = [] > for word in sentence.split(): > if word.endswith('/ADJ'): > adjectives.append(word) > elif word.endswith('/N'): > buffer.append(word) > buffer.extend(adjectives) > > adjectives = [] > else: > buffer.append(word) > return ' '.join(buffer)
Does the classification scheme allow for adjectives that are not followed by a noun? Example: if "good" in the sentence "That looks good" were classified as an adjective it would be silently dropped. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor