Detect prefix and/or suffix in python

25 views Asked by At

I'm trying to write a program to detect whether a word has a prefix and/or a suffix. Normally, I'd just use .startswith() and .endswith(). I'd prefer not to use that here because certain words, like 'antique' will get incorrectly interpreted as having a prefix of 'anti', even though that's not what the 'anti' represents.

I've thought about using Machine Learning, but am wondering if that would even be beneficial because I could just use the dataset that I used to train the ML algorithm as a dataset, and just lookup words there.

Are there any workarounds to this? Or do I just have to use a dataset? If so, where can I find such a dataset?

0

There are 0 answers