Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80268

Re: I need algorithm for my task

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'key.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'repeated': 0.09; 'python': 0.11; 'examples:': 0.16; 'occurences': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'repetition': 0.16; 'wrote:': 0.18; 'any,': 0.19; 'split': 0.19; 'subject:need': 0.19; 'foundation': 0.20; 'header:User- Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'rest': 0.29; "skip:' 10": 0.31; '(possibly': 0.31; 'letter.': 0.31; 'text': 0.33; 'there': 0.35; 'false': 0.36; "didn't": 0.36; 'implement': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'simple': 0.61; 'first': 0.61; 'email addr:gmail.com': 0.63; 'fifa': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: I need algorithm for my task
Date Wed, 05 Nov 2014 13:36:17 +0100
Organization None
References <50a7df31-ee6c-45f5-9dd8-6ac895ec46cf@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bd9e98.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15497.1415190991.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415190991 news.xs4all.nl 2947 [2001:888:2000:d::a6]:59581
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80268

Show key headers only | View raw


lordvital21@gmail.com wrote:

> I have line 'pythonpythonpyth'. How do I know which word is the foundation
> line?. Other examples:
> "pythonpythonpyth" is python
> "DOLORIUMD" is DOLORIUM
> "HELLOLHELLO" is HELLOL
> "thewordword" is thewordword
> 
> I need to know whether the word in the text is repeated and get it. This
> will be the key.

A simple approach that might work (I didn't implement it to verify):

Look for other occurences of the first letter. If there are none you have 
the "foundation", if there are any, split the line before them and check if 
the rest of the line can be constructed as a (possibly truncated) repetition 
of the beginning. For

fifafofifaf

you'd have to check

fi fafofifaf --> false
fifa fofifaf --> false
fifafo fifaf --> true

so we don't care about

fifafofi faf
fifafofifa f

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

I need algorithm for my task lordvital21@gmail.com - 2014-11-05 03:58 -0800
  Re: I need algorithm for my task Chris Angelico <rosuav@gmail.com> - 2014-11-05 23:29 +1100
    Re: I need algorithm for my task Darren Chen <ccylily1314@gmail.com> - 2014-11-06 17:42 -0800
  Re: I need algorithm for my task Peter Otten <__peter__@web.de> - 2014-11-05 13:36 +0100
  Re: I need algorithm for my task Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-05 15:19 +0000
  Re: I need algorithm for my task MRAB <python@mrabarnett.plus.com> - 2014-11-05 17:53 +0000
  Re: I need algorithm for my task wxjmfauth@gmail.com - 2014-11-05 11:07 -0800
    Re: I need algorithm for my task wxjmfauth@gmail.com - 2014-11-05 11:29 -0800
      Re: I need algorithm for my task wxjmfauth@gmail.com - 2014-11-05 22:31 -0800

csiph-web