wowool-common 3.1.1.dev1__py3-none-any.whl → 3.1.2.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of wowool-common might be problematic. Click here for more details.
- wowool/document/analysis/document.py +2 -2
- wowool/document/document_interface.py +16 -15
- wowool/document/factory.py +5 -1
- wowool/document/serialize.py +1 -0
- {wowool_common-3.1.1.dev1.dist-info → wowool_common-3.1.2.dev2.dist-info}/METADATA +1 -1
- {wowool_common-3.1.1.dev1.dist-info → wowool_common-3.1.2.dev2.dist-info}/RECORD +8 -8
- {wowool_common-3.1.1.dev1.dist-info → wowool_common-3.1.2.dev2.dist-info}/WHEEL +0 -0
- {wowool_common-3.1.1.dev1.dist-info → wowool_common-3.1.2.dev2.dist-info}/top_level.txt +0 -0
|
@@ -206,7 +206,7 @@ class AnalysisDocument(DocumentInterface):
|
|
|
206
206
|
return json.loads(json.dumps(document, cls=Encoder))
|
|
207
207
|
|
|
208
208
|
@staticmethod
|
|
209
|
-
def
|
|
209
|
+
def from_dict(document_json: dict) -> "AnalysisDocument":
|
|
210
210
|
assert WJ_ID in document_json, "Invalid Document json format"
|
|
211
211
|
assert WJ_DATA_TYPE in document_json, "Invalid Document json format"
|
|
212
212
|
assert AnalysisInputProvider.DATA_TYPE in document_json[WJ_DATA_TYPE]
|
|
@@ -385,4 +385,4 @@ class AnalysisDocument(DocumentInterface):
|
|
|
385
385
|
:rtype: ``Document``
|
|
386
386
|
"""
|
|
387
387
|
|
|
388
|
-
return AnalysisDocument.
|
|
388
|
+
return AnalysisDocument.from_dict(document)
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
from typing import Protocol, runtime_checkable, Any
|
|
2
2
|
from wowool.document.defines import WJ_ID, WJ_DATA, WJ_DATA_TYPE, WJ_METADATA
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
DataType = Literal[
|
|
6
|
+
"text/utf8",
|
|
7
|
+
"text/raw",
|
|
8
|
+
"md/utf8",
|
|
9
|
+
"html/utf8",
|
|
10
|
+
"html/raw",
|
|
11
|
+
"pdf/utf8",
|
|
12
|
+
"pdf/raw",
|
|
13
|
+
"docx/utf8",
|
|
14
|
+
"docx/raw",
|
|
15
|
+
"analysis/json",
|
|
16
|
+
]
|
|
3
17
|
|
|
4
18
|
|
|
5
19
|
@runtime_checkable
|
|
@@ -13,7 +27,7 @@ class DocumentInterface(Protocol):
|
|
|
13
27
|
pass
|
|
14
28
|
|
|
15
29
|
@property
|
|
16
|
-
def data_type(self) ->
|
|
30
|
+
def data_type(self) -> DataType:
|
|
17
31
|
pass
|
|
18
32
|
|
|
19
33
|
@property
|
|
@@ -21,22 +35,9 @@ class DocumentInterface(Protocol):
|
|
|
21
35
|
pass
|
|
22
36
|
|
|
23
37
|
@property
|
|
24
|
-
def metadata(self) -> dict:
|
|
38
|
+
def metadata(self) -> dict[str, Any]:
|
|
25
39
|
pass
|
|
26
40
|
|
|
27
|
-
def to_json(self):
|
|
28
|
-
"""
|
|
29
|
-
Convert the document to JSON format.
|
|
30
|
-
:return: JSON representation of the document.
|
|
31
|
-
:rtype: ``dict``
|
|
32
|
-
"""
|
|
33
|
-
return {
|
|
34
|
-
WJ_ID: self.id,
|
|
35
|
-
WJ_DATA: self.data,
|
|
36
|
-
WJ_DATA_TYPE: self.data_type,
|
|
37
|
-
WJ_METADATA: self.metadata,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
41
|
def serialize(self):
|
|
41
42
|
"""
|
|
42
43
|
Convert the document to JSON format.
|
wowool/document/factory.py
CHANGED
|
@@ -36,7 +36,10 @@ def _make_str(uid, data, encoding, metadata: dict | None = None, **kwargs) -> Do
|
|
|
36
36
|
def _make_file(uid, data, encoding, metadata: dict | None = None, **kwargs) -> DocumentInterface:
|
|
37
37
|
from wowool.io.provider.file import FileInputProvider
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
options = {}
|
|
40
|
+
if "cleanup" in kwargs:
|
|
41
|
+
options["cleanup"] = kwargs["cleanup"]
|
|
42
|
+
return FileInputProvider(fid=uid, encoding=encoding, metadata=metadata, **options)
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
def _make_html(uid, data, encoding, metadata: dict | None = None, **kwargs) -> DocumentInterface:
|
|
@@ -88,6 +91,7 @@ creators = {
|
|
|
88
91
|
"pdf": _make_pdf,
|
|
89
92
|
"docx": _make_docx,
|
|
90
93
|
"file/utf8": _make_file,
|
|
94
|
+
"md/utf8": _make_file,
|
|
91
95
|
"html/utf8": _make_html,
|
|
92
96
|
"pdf/utf8": _make_pdf,
|
|
93
97
|
"docx/utf8": _make_docx,
|
wowool/document/serialize.py
CHANGED
|
@@ -17,12 +17,12 @@ wowool/common/pipeline/objects.py,sha256=DrkYQfniCJjDP8fE9U6OcX24hccImOhduJno8sf
|
|
|
17
17
|
wowool/document/__init__.py,sha256=CRicpiVDFsj4_pUNWuXxon52-BdHguhgE01SpEHqoVw,111
|
|
18
18
|
wowool/document/defines.py,sha256=aSF2ClfIRGDvzJJWRA58JRcYfjc8VM9hapw9FUuIuPQ,101
|
|
19
19
|
wowool/document/document.py,sha256=hH3wC5joNp9ds0NPRVpPylodev4LVweInGXw9Xn26pk,3225
|
|
20
|
-
wowool/document/document_interface.py,sha256=
|
|
21
|
-
wowool/document/factory.py,sha256=
|
|
22
|
-
wowool/document/serialize.py,sha256=
|
|
20
|
+
wowool/document/document_interface.py,sha256=v7TOhYQf4p0YxlsW1v8RBNcaPO6PZMJuYf_wVX1uKX0,1000
|
|
21
|
+
wowool/document/factory.py,sha256=R7W5LAmDC2fuUa9IcCBKSZTVEb3LrtGPqzLD5mbVIG0,10089
|
|
22
|
+
wowool/document/serialize.py,sha256=aC9GLoALJ_VCcCI6GtFyBczUAF0rdN_MjX2VgCxzP5I,1646
|
|
23
23
|
wowool/document/analysis/analysis.py,sha256=kB7kWEFrLtg0Zz7gmnypzkhkibl_UwqGavTttJxFBsY,9113
|
|
24
24
|
wowool/document/analysis/analysis_parser.py,sha256=-dWF_Ag0UyjF0lg5ppPL-YTEh4bhwNpEo-m3swvYqwY,3723
|
|
25
|
-
wowool/document/analysis/document.py,sha256=
|
|
25
|
+
wowool/document/analysis/document.py,sha256=0nlII1zcwb25hUfzS6xEhMN9Q36ljFJlOyewWQbYtJc,13756
|
|
26
26
|
wowool/document/analysis/apps/chunks.py,sha256=gQKzQkuxCYlbsyQT3QCoHymBQX_lIUsTwaah3AOFvLE,629
|
|
27
27
|
wowool/document/analysis/apps/themes.py,sha256=YPgcXQc1VimVkfsNywr_oHeDSuEbhtz6SNRYkZzu7AU,198
|
|
28
28
|
wowool/document/analysis/apps/topics.py,sha256=qAhbXyjvhK_Y0t5ffelEpZvcqlbylcmu85Q_LZ1_mwQ,198
|
|
@@ -55,7 +55,7 @@ wowool/utility/iterators/__init__.py,sha256=oOnKogPeE-Yhky1lTsX1cEgYnWORdF-iqSTN
|
|
|
55
55
|
wowool/utility/path/__init__.py,sha256=8fzkUt2NwTbeoIjCUVR8tPgvHrCWLXaxXKZlC0oa_xQ,63
|
|
56
56
|
wowool/utility/path/path.py,sha256=6LSPGXUyiYtKP_7LzxDaHUq0UYGIg-Zvgvpc2fdJBA8,285
|
|
57
57
|
wowool/utility/text/cleanup.py,sha256=vN6I9n5PJN2EEhTaxyD2_jSVJ_BGI3EGaMr06LvgRT0,2886
|
|
58
|
-
wowool_common-3.1.
|
|
59
|
-
wowool_common-3.1.
|
|
60
|
-
wowool_common-3.1.
|
|
61
|
-
wowool_common-3.1.
|
|
58
|
+
wowool_common-3.1.2.dev2.dist-info/METADATA,sha256=9JXmAiHfkblmRzb4bztSdi0h2V9FJ48o_7zCr6IvzQY,229
|
|
59
|
+
wowool_common-3.1.2.dev2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
60
|
+
wowool_common-3.1.2.dev2.dist-info/top_level.txt,sha256=zerqoDN-iHSHwsS1SN2h0q4H6RI1FOVeHW8fNQC9YdU,7
|
|
61
|
+
wowool_common-3.1.2.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|