Changed environment variable behavior to accept comma separated models rather than a JSON encoded value

This commit is contained in:
Netkas 2023-07-23 16:23:17 -04:00
parent f681267999
commit caa5f66389
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
3 changed files with 10 additions and 2 deletions

View file

@ -10,6 +10,6 @@ services:
tty: true
environment:
- KEYBERT_PORT=2131
- KEYBERT_PRELOAD=["paraphrase-multilingual-MiniLM-L12-v2"]
- KEYBERT_PRELOAD=paraphrase-multilingual-MiniLM-L12-v2
ports:
- "2131:2131"

View file

@ -30,6 +30,14 @@
else
{
$preload = getenv('KEYBERT_PRELOAD');
if($preload === false || $preload == '')
{
$preload = null;
}
else
{
$preload = explode(',', $preload);
}
}
$keybert = new Keybert($preload, null, $port);

View file

@ -3,7 +3,7 @@
require 'ncc';
import('net.nosial.keybert');
$keybert = new \Keybert\Keybert(null, '127.0.0.1', 1241);
$keybert = new \Keybert\Keybert(null, '127.0.0.1', 2131);
$document = 'The history of natural language processing (NLP) generally started in the 1950s, although work can be found from earlier periods. In 1950, Alan Turing published an article titled "Computing Machinery and Intelligence" which proposed what is now called the Turing test as a criterion of intelligence.';
$keywords = $keybert->extractKeywords('paraphrase-multilingual-MiniLM-L12-v2', $document);