-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用簡體中文素材時出現錯誤 #2
Comments
嗨!感謝你提出這個問題,方便提供給我你使用的資料嗎? 我想可能是來自於資料所使用的編碼或許不是"utf-8" |
非常感謝你的回复,我是用的是UTF-8編碼,而且只會在topic3出現同樣的錯誤。這使得我非常困惑,我將分享我所使用的數據,透過如下的github專案連結。https://github.com/cauzp/data |
Ok 我來研究一下 |
哈囉,我嘗試用以下代碼檢查了以下你的檔案,裏面有些行數包含了非 utf-8 編碼的資訊: import chardet
def detect_line_encoding(line):
result = chardet.detect(line)
return result
file_path = 'YOUR_FILE_PATH.csv'
with open(file_path, 'rb') as f:
for line_number, line in enumerate(f, start=1):
encoding_info = detect_line_encoding(line)
encoding = encoding_info['encoding']
confidence = encoding_info['confidence']
if encoding != 'utf-8':
print(f"Line {line_number}: Detected encoding: {encoding}, Confidence: {confidence}") 檢查結果:
在直接爬下來或比較舊的中文資料裡面常常會有一些資料是使用非 utf-8 的編碼,然而因為多數語言模型都是使用 utf-8 編碼的資料進行訓練的,所以需要首先確保數據是正確解碼並轉換為UTF-8格式。 |
您好!您的項目給我提供了很多幫助!我clone了你的項目,但是更換使用簡體中文的語料時,部分主題出現了亂碼,您能提供一些支持嗎?如果我希望使用您的項目處理簡體中文的語料?特別是需要具體修改哪些部分?因爲我髮現您的項目相較於原始樣本做出了較多修改。
The text was updated successfully, but these errors were encountered: