The title is not the best but since I have no clue what I'm actually searching I simply used something broad. I'm searching for a an algorithm, a class of algorithms or at least keywords I can use for further research.
Essentially I'm searching for a hash-like function that takes an input and boils it down to a much more compact representation. I want similar inputs to be somewhat near each other and I want certain parts of the input to be weighted higher/lower than other parts. I don't care how the distance is as long as I have a partial ordering so I can group similar entries together.
As an example lets assume I have the Input strings:
A = alittlebeer
B = alittlebear
C = blittlebear
And lets assume that I define my weight so that I weight the first 3 characters much higher than the rest. Then I would expect that $|f(A) - f(B)| << |f(B) - f(C)| < |f(C) - f(A)|$