Tika
TikaParser
A class for parsing content from files and file bytes using Apache Tika.
Attributes:
Name | Type | Description |
---|---|---|
tika_server |
str
|
The endpoint for the Tika server. Defaults to 'http://localhost:8002/'. |
Source code in model/tika.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
__init__(tika_server='http://localhost:8002/')
Initializes the TikaParser instance with a Tika server endpoint and starts the Tika Java Virtual Machine.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tika_server
|
str
|
The endpoint for the Tika server. Defaults to 'http://localhost:8002/'. |
'http://localhost:8002/'
|
Source code in model/tika.py
13 14 15 16 17 18 19 20 21 |
|
hash_file_bytes(file_bytes)
Generates a SHA-256 hash for the given file bytes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_bytes
|
bytes
|
The binary content of the file to hash. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The SHA-256 hash of the file content. |
Source code in model/tika.py
51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
tika_parser_from_bytes(file_binary)
Parses the content of a file provided as bytes using the Tika server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_binary
|
bytes
|
The binary content of the file to parse. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The parsed content of the file. |
Source code in model/tika.py
23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
tika_parser_from_file_path(file_path)
Parses the content of a file provided via file path using the Tika server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
The path to the file to parse. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The parsed content of the file. |
Source code in model/tika.py
37 38 39 40 41 42 43 44 45 46 47 48 49 |
|