damus icon indicating copy to clipboard operation
damus copied to clipboard

detect chinese dialect

Open alltheseas opened this issue 1 year ago • 8 comments

potential approach:

-detect correctly -dont send language detect

alltheseas avatar May 17 '24 16:05 alltheseas

@tyiu do you know how apple detects Chinese language(s)?

alltheseas avatar May 17 '24 18:05 alltheseas

Can you provide more context? Is there a specific example? Which Chinese dialects are you referring to? In general, I don't think what you're asking is even possible.

tyiu avatar May 17 '24 20:05 tyiu

maybe this got lost in the meeting notes, but feedback from @semisol was:

jb55: Hmm these don’t seem to translate for some reason, not supported? https://damus.io/nevent1qqst492mjessnswr6usw0007kff977ka4s8zpjlatnlvrsr3jlhmwtcpzpmhxue69uhkummnw3ezuamfdejsz9nhwden5te0wfjkccte9ehx7um5wghxyctwvsq32amnwvaz7tm9v3jkutnwdaehgu3wd3skueqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduncq76h

semisol: oh yeah, I you need to specify zh-* (replace * with something I forgot) not zh-

jb55 avatar May 17 '24 22:05 jb55

you need to specify zh-Hant/zh-Hans instead of zh if you are doing that. NLLanguage does that for you actually, so I don't know what's happening.

Semisol avatar May 17 '24 23:05 Semisol

It works for me. I'm also receiving requests for translating Chinese, but I only have received <50 in the last 7 days.

image

Semisol avatar May 17 '24 23:05 Semisol

you need to specify zh-Hant/zh-Hans instead of zh if you are doing that. NLLanguage does that for you actually, so I don't know what's happening.

I added code to intentionally drop the variant part of the detected locale from NLLanguageRecognizer. I didn't realize that we shouldn't be doing this for Chinese. https://github.com/damus-io/damus/blob/c99aaea5980121a89c7499665fcb5d45faa1f936/nostrdb/NdbNote.swift#L475-L477

tyiu avatar May 18 '24 02:05 tyiu

For example, DeepL expects only zh as the source locale. So maybe it depends on the translation service.

https://developers.deepl.com/docs/resources/supported-languages#source-languages

tyiu avatar May 18 '24 02:05 tyiu

For example, DeepL expects only zh as the source locale. So maybe it depends on the translation service.

https://developers.deepl.com/docs/resources/supported-languages#source-languages

Yeah. I think for Damus Purple the locale should be dropped at the API layer, not client.

Semisol avatar May 18 '24 09:05 Semisol