diff --git a/docker-compose.yml b/docker-compose.yml index 9c2d0eb..9f37a2b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" \ No newline at end of file diff --git a/src/Keybert/Program.php b/src/Keybert/Program.php index 5af5f49..cd398e7 100644 --- a/src/Keybert/Program.php +++ b/src/Keybert/Program.php @@ -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); diff --git a/tests/model_test.php b/tests/model_test.php index 4074b28..b8a0d15 100644 --- a/tests/model_test.php +++ b/tests/model_test.php @@ -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);