Skip to content

Support for Cantonese #9

@afaiza

Description

@afaiza

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions