This commit is contained in:
33
docs/snippets/dart/advanced/keyword_extraction_example.md
Normal file
33
docs/snippets/dart/advanced/keyword_extraction_example.md
Normal file
@@ -0,0 +1,33 @@
|
||||
```dart title="Dart"
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart' show Int64List;
|
||||
|
||||
import 'package:kreuzberg/kreuzberg.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
final config = ExtractionConfig(
|
||||
useCache: true,
|
||||
enableQualityProcessing: true,
|
||||
forceOcr: false,
|
||||
disableOcr: false,
|
||||
keywords: KeywordConfig(
|
||||
algorithm: KeywordAlgorithm.yake,
|
||||
maxKeywords: 10,
|
||||
minScore: 0.3,
|
||||
ngramRange: Int64List.fromList(<int>[1, 3]),
|
||||
),
|
||||
resultFormat: ResultFormat.unified,
|
||||
outputFormat: OutputFormat.plain(),
|
||||
includeDocumentStructure: false,
|
||||
useLayoutForMarkdown: false,
|
||||
maxArchiveDepth: 3,
|
||||
);
|
||||
|
||||
final result = await KreuzbergBridge.extractFile('research_paper.pdf', null, config);
|
||||
final keywords = result.extractedKeywords;
|
||||
if (keywords != null) {
|
||||
for (final keyword in keywords) {
|
||||
print('${keyword.text} (score: ${keyword.score})');
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user