This commit is contained in:
26
docs/snippets/php/advanced/keyword_extraction_config.md
Normal file
26
docs/snippets/php/advanced/keyword_extraction_config.md
Normal file
@@ -0,0 +1,26 @@
|
||||
```php title="PHP"
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Kreuzberg\Kreuzberg;
|
||||
use Kreuzberg\ExtractionConfig;
|
||||
use Kreuzberg\KeywordConfig;
|
||||
|
||||
$config = new ExtractionConfig(
|
||||
keywords: new KeywordConfig(
|
||||
algorithm: 'yake',
|
||||
maxKeywords: 10,
|
||||
minScore: 0.1,
|
||||
language: 'en'
|
||||
)
|
||||
);
|
||||
|
||||
$result = Kreuzberg::extractFileSync('document.pdf', null, $config);
|
||||
|
||||
if ($result->getKeywords()) {
|
||||
foreach ($result->getKeywords() as $keyword) {
|
||||
echo $keyword . "\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
```
|
||||
Reference in New Issue
Block a user