CLD: New plugin for language detection via CLD2 #1425
No reviewers
Labels
No labels
2018.09
2019.01
2019.03
2019.06
2019.09
2019.12
2020.03
2020.06
2020.09
2020.12
2021.03
2021.07
2021.09
2022.02
2022.06
2022.09
2022.12
2023.04
2023.05
2023.09
2024.03
2024.06
2024.09
2024.12
dependencies
Hackathon 2021
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: friendica/friendica-addons#1425
Loading…
Reference in a new issue
No description provided.
Delete branch "heluecht/friendica-addons:cld2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The CLD2 detection is superior to our used detection, but it is not really easy to install. So it is added as an addon.
CLD: New plugin for language detection via CLD2 #1423to CLD: New plugin for language detection via CLD2@ -0,0 +62,4 @@
cd /etc/php/8.0/mods-available
```
Create the file `cld.ini` with this content:
This file should be called
cld2.ini
as it's the name of the module. This also enablesphpenmod cld2
on Debian-based distributions.Done
@ -0,0 +69,4 @@
extension=cld2.so
```
Change to the folder `conf.d` in the folder of your `php.ini`.
On Debian-based distributions, this can be replaced by running
phpenmod cld2
.done
@ -0,0 +12,4 @@
function cld_install()
{
Hook::register('detect_languages', 'addon/cld/cld.php', 'cld_detect_languages');
Please avoid hardcoded file paths when you can.
Done
@ -0,0 +64,4 @@
}
Logger::debug('Detected different language', ['original' => $original, 'detected' => $detected, 'name' => $result['language_name'], 'probability' => $result['language_probability'], 'text' => $data['text']]);
$data['detected'] = [$detected => $result['language_probability'] / 100];
I thought the
detected
key was only a list of language codes. Please mention in the documentation of the hookdetect_languages
that it's an associative array with the language code as the keys and the language probability as the values.CLD: New plugin for language detection via CLD2to CLD: New plugin for language detection via CLD2