0
$\begingroup$

I'm playing around with the TextBlob library for python. It has in it a NaiveBayesClassifier as well as a DecisionTreeClassifier. However, they do not work for my purposes. I need to be able to look at differences between strings, preferably in form that lends itself to template-like substitution of the different parts.

So for example, suppose we train with: $$ \psi : \\ aAb \mapsto 0, \\ a b \mapsto 1, $$ Then it should automatically recognize, either, the absence of the $A$, or the presence of something else besides the $A$:

$$ \psi(ac) = 1 \\ $$

for example, is possible immediately after the two samples. Maybe there should be settings to choose what / how the differences are made.

I'd also like it to be able to create "substitution templates" between the input and output of a mapping. So if $aAb \mapsto cAd$ is a mapping, then it knows when it sees $aBb$ to map it to $cBd$. I think there should be some interesting math involved in this problem, intuitively.

Take a look at this image:

Commuting square of string substitution morphisms.

In the language of category theory, it commutes. But it has two mappings from $aAb$ so I don't know how we'd handle that in terms of classification.

$a, b, c, A,B,C,D$ are all strings, the capital letters were just for convenience.

$\endgroup$
  • $\begingroup$ It sounds like you have two separate questions here: one about binary classification, one about learning a string-to-string mapping. Perhaps ask each separately? When you write $aAb$, I'm not sure if we are told in advance which symbols are "uppercase" and which are "lowercase" and if the uppercase ones are supposed to be treated differently. Here's a summary of some methods I know of: datascience.stackexchange.com/q/16115/8560. It sounds like you might be interested in grammar induction, perhaps induction of context-free grammars. $\endgroup$ – D.W. Sep 4 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.