39 lines
1.3 KiB
Markdown
39 lines
1.3 KiB
Markdown
# RDAIReaderView
|
|
|
|
`RDAIReaderView` is the local indexing and retrieval foundation for ReadViewSDK AI reader features. Version `0.1` provides Natural Language sentence chunking, language detection, named-entity candidates, source-backed citations and local lexical retrieval. It does not upload book content.
|
|
|
|
## Install
|
|
|
|
```ruby
|
|
pod 'RDAIReaderView/NaturalLanguage'
|
|
pod 'RDPDFReaderView/AI'
|
|
pod 'RDEpubReaderView/AI'
|
|
```
|
|
|
|
## Use with PDF
|
|
|
|
```swift
|
|
let service = reader.makeAIReaderService()
|
|
try await service.prepareIndex(
|
|
options: RDAIIndexOptions(scope: .wholeDocument)
|
|
)
|
|
|
|
let matches = await service.retrieve(
|
|
query: "主角为什么离开",
|
|
options: RDAIRetrievalOptions(scope: .wholeDocument)
|
|
)
|
|
|
|
if let match = matches.first {
|
|
let citation = RDAICitation(
|
|
passageIdentifier: match.passage.id,
|
|
quote: match.passage.text,
|
|
locator: match.passage.locator
|
|
)
|
|
try await reader.makeAIContentProvider().aiShowCitationHighlight(citation)
|
|
}
|
|
```
|
|
|
|
PDF citations retain native-text versus OCR provenance. EPUB citations use normalized `href` and derive CFI ranges when navigating.
|
|
|
|
Foundation Models generation, persistent SQLite storage and the AI UI are planned follow-up modules; the Core API is intentionally independent of those capabilities.
|