mardi 6 août 2019

How to detect recurrent patterns in a textfile

To simplify a function with many terms, a program would be useful that searches for patterns in a file and arranges them in a ranking list. I can imagine that this is an elaborate process, but I'm sure there are people who have built something like this. An example of a text:

sin(t1)*cos(t1)*t1+t1-sin(t1)*sin(t1-pi)

This should give me such an output like this (min. 2 letters):

 6x: "t1" 
 4x: "(t1"
 3x: "n(t1"
 3x: "sin"
 3x: "sin("
 2x: "sin(t1)"

 etc.

Does this problem have a name (which I don't know). Is there a known algorithm that could solve the problem for me?

Aucun commentaire:

Enregistrer un commentaire