CLD: New plugin for language detection via CLD2 #1425

Merged
MrPetovan merged 6 commits from heluecht/friendica-addons:cld2 into 2023.09-rc 2023-10-07 07:07:00 +02:00
Owner

The CLD2 detection is superior to our used detection, but it is not really easy to install. So it is added as an addon.

The CLD2 detection is superior to our used detection, but it is not really easy to install. So it is added as an addon.
heluecht added 3 commits 2023-10-01 09:10:48 +02:00
heluecht changed title from CLD: New plugin for language detection via CLD2 #1423 to CLD: New plugin for language detection via CLD2 2023-10-01 15:57:57 +02:00
MrPetovan requested changes 2023-10-03 03:51:53 +02:00
cld/README.md Outdated
@ -0,0 +62,4 @@
cd /etc/php/8.0/mods-available
```
Create the file `cld.ini` with this content:
Owner

This file should be called cld2.ini as it's the name of the module. This also enables phpenmod cld2 on Debian-based distributions.

This file should be called `cld2.ini` as it's the name of the module. This also enables `phpenmod cld2` on Debian-based distributions.
Author
Owner

Done

Done
cld/README.md Outdated
@ -0,0 +69,4 @@
extension=cld2.so
```
Change to the folder `conf.d` in the folder of your `php.ini`.
Owner

On Debian-based distributions, this can be replaced by running phpenmod cld2.

On Debian-based distributions, this can be replaced by running `phpenmod cld2`.
Author
Owner

done

done
cld/cld.php Outdated
@ -0,0 +12,4 @@
function cld_install()
{
Hook::register('detect_languages', 'addon/cld/cld.php', 'cld_detect_languages');
Owner

Please avoid hardcoded file paths when you can.

	Hook::register('detect_languages', __FILE__, 'cld_detect_languages');
Please avoid hardcoded file paths when you can. ```php Hook::register('detect_languages', __FILE__, 'cld_detect_languages'); ```
Author
Owner

Done

Done
cld/cld.php Outdated
@ -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];
Owner

I thought the detected key was only a list of language codes. Please mention in the documentation of the hook detect_languages that it's an associative array with the language code as the keys and the language probability as the values.

I thought the `detected` key was only a list of language codes. Please mention in the documentation of the hook `detect_languages` that it's an associative array with the language code as the keys and the language probability as the values.
MrPetovan added the
2023.09
label 2023-10-03 03:52:01 +02:00
heluecht added 1 commit 2023-10-06 05:54:52 +02:00
heluecht added 4 commits 2023-10-06 05:57:05 +02:00
heluecht added 1 commit 2023-10-06 06:14:36 +02:00
heluecht changed title from CLD: New plugin for language detection via CLD2 to CLD: New plugin for language detection via CLD2 2023-10-06 06:15:58 +02:00
heluecht changed target branch from develop to 2023.09-rc 2023-10-06 06:15:58 +02:00
MrPetovan approved these changes 2023-10-07 07:06:56 +02:00
MrPetovan merged commit fbafa80815 into 2023.09-rc 2023-10-07 07:07:00 +02:00
Sign in to join this conversation.
No description provided.