[Numpy-discussion] Reading String type to find long "magic word"
kalatsky at gmail.com
Fri Apr 19 20:05:27 EDT 2013
Here's a seed for your function:
s = 'ThesampletextthatcouldbereadedthesameinbothordersArozaupalanalapuazorA'
f = np.array(list(s)).view('int8').astype(float)
f -= f.mean()
maybe_here = np.argmax(np.convolve(f,f))/2
magic = 10
print s[maybe_here - magic:maybe_here + magic + 1]
Let us now how to assign significance to the result and to find optimal
On Fri, Apr 19, 2013 at 6:01 PM, Bakhtiyor Zokhidov <
bakhtiyor_zokhidov at mail.ru> wrote:
> Hello everybody,
> I just have one long string
> The result I want to take is ArozaupalanalapuazorA - which means reading
> directly each letter should be the same as reading reversely ...
> Is there any function which can deals with this problem in Python???
> Thanks for answer
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion