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


Groups > comp.lang.python > #79645

Re: python student at university of jordan.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
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; '(even': 0.05; '%s"': 0.09; 'shifting': 0.09; 'statements': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7.2': 0.16; 'ends,': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'get,': 0.16; 'non-english': 0.16; 'posting:': 0.16; 'subject:student': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'do,': 0.16; 'wrote:': 0.18; '(not': 0.18; 'module': 0.19; 'trying': 0.19; 'slightly': 0.19; 'appears': 0.22; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'install': 0.23; 'error': 0.23; 'bytes': 0.24; 'cc:2**0': 0.24; 'changes,': 0.26; 'right.': 0.26; 'second': 0.26; 'post': 0.26; 'header:In-Reply- To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'gives': 0.31; 'code': 0.31; 'getting': 0.31; 'too.': 0.31; '25,': 0.31; 'probably': 0.32; 'compatible': 0.32; 'run': 0.32; 'text': 0.33; 'plain': 0.33; 'actual': 0.34; 'trouble': 0.34; 'problem': 0.35; "can't": 0.35; 'case,': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'should': 0.36; 'two': 0.37; 'list': 0.37; 'problems': 0.38; 'pm,': 0.38; 'extremely': 0.39; 'highest': 0.39; 'sure': 0.39; 'how': 0.40; 'new': 0.61; "you're": 0.61; 'first': 0.61; "you'll": 0.62; 'different': 0.65; 'chance': 0.65; 'latest': 0.67; '2.7.': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Aq8Sv7EsdNCpeI26VjO6F8c4tYmXGln5z0wS8XQqni0=; b=0Kbl5vq3ZM94P66wc6W17QCKhD1lu3EwC9SSEBKYfE7KjnewiRL2nWcEskPCzwqcL4 CpHGPC4ZVx8yEcopPNFhph2yRu/8KN5ljMv3Zwo0HT5qCKLtwtnHfZqLS30FNTSCMWHc yvw3HWGeiv4vm2kaIrqXxMhz2Hh/12QQ6iyng1eh34UU4ERnz9+Q9XX2d/GGoac8mYEe YrRcLq80iNvxY2X3CRrF8UWya1ngBbloJL2T+Tp4ZEbbhrAws8qwxv8XkH9j7wi6pnR3 WERm9LEPChWGGMonT68uhuJ9qFdFaSPGFcuV7biLnRoBfKfg9cKo34/xHFvH05h+ykkS KXeQ==
MIME-Version 1.0
X-Received by 10.107.158.80 with SMTP id h77mr8111276ioe.41.1414202800979; Fri, 24 Oct 2014 19:06:40 -0700 (PDT)
In-Reply-To <1414201662.32895.YahooMailBasic@web122901.mail.ne1.yahoo.com>
References <1414201662.32895.YahooMailBasic@web122901.mail.ne1.yahoo.com>
Date Sat, 25 Oct 2014 13:06:40 +1100
Subject Re: python student at university of jordan.
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.15153.1414202803.18130.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1414202803 news.xs4all.nl 2875 [2001:888:2000:d::a6]:56735
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79645

Show key headers only | View raw


On Sat, Oct 25, 2014 at 12:47 PM, heba abukaff
<habukaff50@yahoo.com.dmarc.invalid> wrote:
> i have a trouble using the tokenizer to find the frequency list for URL using arabic text.and iam using python 2.7.2 on winXP,I tried this code but every time i run the code appears error with first line

I'm seeing two problems here. One of them may not actually be a
problem in your code, but just in how you're posting: your text has
all been rewrapped. Post the exact code, as plain text (not HTML); you
should be able to do this, but if you can't with Yahoo, try a
different email provider. Make sure we can see exactly where your code
begins and ends, so we can understand what "first line" you're looking
at - and if you copy and paste the actual error you get, that would be
extremely helpful, too. (Even if it's in Arabic. There'll be parts we
can understand.)

The second problem is that you're trying to work with non-English text
in Python 2.7. This is harder than it needs to be. Install the latest
Python (3.4) and use that instead of 2.7; the NLTK module is
compatible with 3.2+, so it should work fine. I can't be sure that
you're having trouble with bytes vs strings, because I can't see what
your code's doing (due to the wrap/indent problem), but in any case,
shifting to Python 3 gives you a much better chance of getting things
right. All you'll need to do, I suspect, is change your print
statements into function calls:

# Old style:
print "word with highest count: %s" % (fd.max())
# New style:
print("word with highest count: %s" % (fd.max()))

Easy! And only slightly harder when you send it to a different destination:

# Old style:
print>>outfile, '%s\t%d' % (t, len(t))
# New style:
print('%s\t%d' % (t, len(t)), file=outfile)

With those changes, your code will probably (I can't test it) work on
Python 3.4.

ChrisA

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


Thread

Re: python student at university of jordan. Chris Angelico <rosuav@gmail.com> - 2014-10-25 13:06 +1100

csiph-web