This commit is contained in:
32
docs/snippets/dart/metadata/language_detection.md
Normal file
32
docs/snippets/dart/metadata/language_detection.md
Normal file
@@ -0,0 +1,32 @@
|
||||
```dart title="Dart"
|
||||
import 'package:kreuzberg/kreuzberg.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
final languageDetection = LanguageDetectionConfig(
|
||||
enabled: true,
|
||||
minConfidence: 0.5,
|
||||
detectMultiple: false,
|
||||
);
|
||||
|
||||
final config = ExtractionConfig(
|
||||
useCache: true,
|
||||
enableQualityProcessing: true,
|
||||
forceOcr: false,
|
||||
disableOcr: false,
|
||||
resultFormat: ResultFormat.unified,
|
||||
outputFormat: OutputFormat.plain(),
|
||||
includeDocumentStructure: false,
|
||||
maxArchiveDepth: 3,
|
||||
useLayoutForMarkdown: false, languageDetection: languageDetection,
|
||||
);
|
||||
|
||||
final result = await KreuzbergBridge.extractFile('document.pdf', null, config);
|
||||
|
||||
final detected = result.detectedLanguages;
|
||||
if (detected != null && detected.isNotEmpty) {
|
||||
print('Primary language: ${detected.first}');
|
||||
} else {
|
||||
print('No language detected');
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user