Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Yesterday at 10:50 AM
Ad icon
Cam ෂෝ කරන්න ආස කෙල්ලෝ
vip video seller srilanka
Updated:
Yesterday at 2:17 AM
Cam show job
vip video seller srilanka
Updated:
Yesterday at 2:01 AM
Vip විඩීයෝ තියේ හොරෙන් රෙකෝඩ් කරපුවා
vip video seller srilanka
Updated:
Yesterday at 1:26 AM
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Monday at 12:26 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Python help !
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="sp3co" data-source="post: 22710416" data-attributes="member: 559702"><p>Python වැඩ්ඩොන්ගෙන් උදව්වක් ඕනේ .. </p><p></p><p>UCSC Sinhala Corpus + NLTK project කරපු කවුද ඉන්නේ ? මම UCSC corpus එක use කරනවා project එකකට. එකේ NLTK වලින් custom corpus open කරන විදියට මේකත් open කරන්න බැලුවේ (NLTK functions use කරන්න නිසා) එත් unicode error එකක් එනවා මේ විදියට </p><p></p><p><em><span style="font-size: 12px">Traceback (most recent call last):</span></em></p><p><em><span style="font-size: 12px"> File "/home/xxxx/PycharmProjects/testing/readcorpus.py", line 13, in <module></span></em></p><p><em><span style="font-size: 12px"> file = read_file.read()</span></em></p><p><em><span style="font-size: 12px"> File "/home/xxxx/.virtualenvs/PycharmProjects/lib/python3.5/codecs.py", line 321, in decode</span></em></p><p><em><span style="font-size: 12px"> (result, consumed) = self._buffer_decode(data, self.errors, final)</span></em></p><p><em><span style="font-size: 12px">UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte</span></em></p><p></p><p>මගේ code එක මේක ... මේකේ readpath එකත් හරි ..ඒත් ඒ file එක read කරන්න යද්දී තමයි error එක එන්නේ </p><p><span style="font-size: 12px"><strong></strong></span></p><p><span style="font-size: 12px"><strong>from nltk.corpus import PlaintextCorpusReader</strong></span></p><p><span style="font-size: 12px"><strong></strong></span></p><p><span style="font-size: 12px"><strong>corpus_root = './resources/corpus/UCSC-Sinhala-News-Corpus/UCSC-Sinhala-News-Corpus-V1'</strong></span></p><p><span style="font-size: 12px"><strong></strong></span></p><p><span style="font-size: 12px"><strong>sinhala_corpus = PlaintextCorpusReader(corpus_root, '.*')</strong></span></p><p><span style="font-size: 12px"><strong></strong></span></p><p><span style="font-size: 12px"><strong>print(sinhala_corpus.fileids())</strong></span></p><p><span style="font-size: 12px"><strong></strong></span></p><p><span style="font-size: 12px"><strong>readpath = './resources/corpus/UCSC-Sinhala-News-Corpus/UCSC-Sinhala-News-Corpus-V1/News Corpus_V1/NPED0001.TXT'</strong></span></p><p><span style="font-size: 12px"><strong></strong></span></p><p><span style="font-size: 12px"><strong>read_file = open(readpath, 'r', encoding='utf-8')</strong></span></p><p><span style="font-size: 12px"><strong>file = read_file.read()</strong></span></p><p></p><p></p><p>මෙහෙම වෙන්නේ ඇයි මේක හදාගන්නේ කොහොමද ?</p><p><span style="color: Red"></span></p><p><span style="color: Red">ඔය text file එක notepad open කලාම type එක තියෙන්නේ unicode.. හැබැයි එක utf-8 කියල save කලාම error එක එන්නේ නෑ file එක read වෙනවා.. එහෙම file type වෙනස් නොකර මේක හදාගන්නේ කොහොමද ?</span></p><p></p><p>Stackoverflow එකේ බැලුව unicode file read කරන්නේ කොහොමද කියල.. ඒකෙ තියෙන්නෙ ඔය විදියට කලාම හරි කියලා</p></blockquote><p></p>
[QUOTE="sp3co, post: 22710416, member: 559702"] Python වැඩ්ඩොන්ගෙන් උදව්වක් ඕනේ .. UCSC Sinhala Corpus + NLTK project කරපු කවුද ඉන්නේ ? මම UCSC corpus එක use කරනවා project එකකට. එකේ NLTK වලින් custom corpus open කරන විදියට මේකත් open කරන්න බැලුවේ (NLTK functions use කරන්න නිසා) එත් unicode error එකක් එනවා මේ විදියට [I][SIZE="3"]Traceback (most recent call last): File "/home/xxxx/PycharmProjects/testing/readcorpus.py", line 13, in <module> file = read_file.read() File "/home/xxxx/.virtualenvs/PycharmProjects/lib/python3.5/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte[/SIZE][/I] මගේ code එක මේක ... මේකේ readpath එකත් හරි ..ඒත් ඒ file එක read කරන්න යද්දී තමයි error එක එන්නේ [SIZE="3"][B] from nltk.corpus import PlaintextCorpusReader corpus_root = './resources/corpus/UCSC-Sinhala-News-Corpus/UCSC-Sinhala-News-Corpus-V1' sinhala_corpus = PlaintextCorpusReader(corpus_root, '.*') print(sinhala_corpus.fileids()) readpath = './resources/corpus/UCSC-Sinhala-News-Corpus/UCSC-Sinhala-News-Corpus-V1/News Corpus_V1/NPED0001.TXT' read_file = open(readpath, 'r', encoding='utf-8') file = read_file.read()[/B][/SIZE] මෙහෙම වෙන්නේ ඇයි මේක හදාගන්නේ කොහොමද ? [COLOR="Red"] ඔය text file එක notepad open කලාම type එක තියෙන්නේ unicode.. හැබැයි එක utf-8 කියල save කලාම error එක එන්නේ නෑ file එක read වෙනවා.. එහෙම file type වෙනස් නොකර මේක හදාගන්නේ කොහොමද ?[/COLOR] Stackoverflow එකේ බැලුව unicode file read කරන්නේ කොහොමද කියල.. ඒකෙ තියෙන්නෙ ඔය විදියට කලාම හරි කියලා [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom