semantify3 API Documentation
semantify³ - Extract knowledge graph ready triples from human-readable annotations wherever possible.
Syntax matters!
Created: 2025-01-29 Authors: Wolfgang Fahl, Tim Holzheim Repository: https://github.com/BITPlan/semantify3
extractor
Command-line interface for semantify³.
# 🌐🕸
extractor:
isA: PythonModule
author: Wolfgang Fahl
createdAt: 2025-11-29
purpose: extraction of relevant markup snippets for semantify³.
Extractor
Extract semantic annotation markup from files.
Source code in sem3/extractor.py
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
__init__(marker='🌐🕸', debug=False)
constructor.
Source code in sem3/extractor.py
35 36 37 38 39 40 | |
extract_from_file(filepath)
Extract markup snippets from a single file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the file to extract from. |
required |
Returns:
| Type | Description |
|---|---|
List[Markup]
|
List[Markup]: List of extracted markup snippets. |
Source code in sem3/extractor.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
extract_from_glob(pattern)
Extract markup snippets from files matching a glob pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Glob pattern to match files (supports **). |
required |
Returns:
| Type | Description |
|---|---|
List[Markup]
|
List[Markup]: All markup snippets from matching files. |
Source code in sem3/extractor.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
extract_from_glob_list(patterns)
Extract markup snippets from files matching multiple glob patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patterns
|
List[str]
|
List of glob patterns to match files. |
required |
Returns:
| Type | Description |
|---|---|
List[Markup]
|
List[Markup]: All markup snippets from matching files. |
Source code in sem3/extractor.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
extract_from_text(text, source_path=None)
Extract all semantic markup snippets from text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The source text to extract from. |
required |
source_path
|
Optional[str]
|
Optional file path for location tracking. |
None
|
Returns:
| Type | Description |
|---|---|
List[Markup]
|
List[Markup]: List of extracted markup snippets. |
Source code in sem3/extractor.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
Markup
dataclass
A single markup.
Source code in sem3/extractor.py
22 23 24 25 26 27 28 29 | |
sem3_cmd
Command-line interface for semantify³.
🌐🕸
sem3_cmd:
isA: PythonModule
author: Wolfgang Fahl
createdAt: 2025-11-29
purpose: Command-line interface for semantify³.
Semantify3Cmd
Bases: BaseCmd
Command line interface for semantify³.
Source code in sem3/sem3_cmd.py
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
__init__()
Initialize the semantify³ command.
Source code in sem3/sem3_cmd.py
26 27 28 | |
get_arg_parser()
Create and configure the argument parser.
Returns:
| Name | Type | Description |
|---|---|---|
ArgumentParser |
ArgumentParser
|
The configured argument parser. |
Source code in sem3/sem3_cmd.py
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 64 65 66 67 68 | |
handle_args(args)
Handle parsed arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
Parsed argument namespace. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if handled, False otherwise. |
Source code in sem3/sem3_cmd.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
main(argv=None)
Main entry point for semantify3 CLI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
Command line arguments. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Exit code. |
Source code in sem3/sem3_cmd.py
102 103 104 105 106 107 108 109 110 111 112 | |
version
Created on 2025-11-29.
@author: wf
Version
Version handling for semantify³.
Source code in sem3/version.py
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 | |