Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Support for Cantonese #9

Open
afaiza opened this issue Mar 29, 2017 · 3 comments
Open

Support for Cantonese #9

afaiza opened this issue Mar 29, 2017 · 3 comments

Comments

@afaiza
Copy link

afaiza commented Mar 29, 2017

Hi,

Thank you for this excellent parser.

I am trying to run this parser on Cantonese entries in Wiktionary, but they are not always found, and when they are found, the data returned is... weird.

I attached an example, where some words that exist in Wiktionary are not returned, and other words actually get different pronunciation (!) than the one written in Wiktionary.

Your help is much appreciated!

Thanks.

This is the code I run:

from wiktionaryparser import WiktionaryParser
import codecs
import sys

parser = WiktionaryParser()

with open('wiktionary_data.txt', "w") as outFile:
    with codecs.open("wordcount.log", "r", encoding="UTF-8") as inFile:
        for line in inFile:
            word = line.split()[0]
            wiktionaryWord = parser.fetch(word, "Chinese")

            if len(wiktionaryWord) > 0:
                outFile.write(word.encode('UTF-8') + "," + str(wiktionaryWord[0]) + "\n")

This is the file wordcount.log

喺 133175
我 84912
個 81040
你 75672
咁 66798
唔 60689
嘅 56333
啊 54957
係 48753
誒 46097
@suyashb95
Copy link
Owner

suyashb95 commented Mar 29, 2017

That's weird, probably the structure of the page is different for cantonese. I'm looking into it. I am assuming you only need the definitions?

@afaiza
Copy link
Author

afaiza commented Mar 30, 2017

Actually, I need more the pronunciations.

Thank you!

@kevinsung
Copy link

This issue really applies to the Chinese languages in general, not just Cantonese. It's related to the issue I raise at #85 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants