emojifics 0.3.0__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.
- composer/__init__.py +5 -0
- composer/compose.py +9 -0
- composer/install.py +9 -0
- emojifics/__init__.py +39 -0
- emojifics/__main__.py +150 -0
- emojifics/compose.py +749 -0
- emojifics/install.py +211 -0
- emojifics/layout.py +82 -0
- emojifics/paths.py +78 -0
- emojifics/py.typed +0 -0
- emojifics/recipes.json +3003 -0
- emojifics-0.3.0.dist-info/METADATA +83 -0
- emojifics-0.3.0.dist-info/RECORD +17 -0
- emojifics-0.3.0.dist-info/WHEEL +5 -0
- emojifics-0.3.0.dist-info/entry_points.txt +2 -0
- emojifics-0.3.0.dist-info/licenses/LICENSE +21 -0
- emojifics-0.3.0.dist-info/top_level.txt +2 -0
composer/__init__.py
ADDED
composer/compose.py
ADDED
composer/install.py
ADDED
emojifics/__init__.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""emojifics: context → picture vars (emoji-sized Unicode; Egyptian parked).
|
|
2
|
+
|
|
3
|
+
Recipes in git. Local pack built at install. Binaries are not stored on GitHub.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from emojifics.compose import (
|
|
7
|
+
FindHit,
|
|
8
|
+
Sign,
|
|
9
|
+
compose,
|
|
10
|
+
compose_text,
|
|
11
|
+
cover_context,
|
|
12
|
+
dark_humor,
|
|
13
|
+
find,
|
|
14
|
+
load_classifiers,
|
|
15
|
+
load_lexicon,
|
|
16
|
+
lookup,
|
|
17
|
+
scan_text,
|
|
18
|
+
)
|
|
19
|
+
from emojifics.layout import quadrat_groups
|
|
20
|
+
from emojifics.paths import pack_dir
|
|
21
|
+
|
|
22
|
+
__version__ = "0.3.0"
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"FindHit",
|
|
26
|
+
"Sign",
|
|
27
|
+
"compose",
|
|
28
|
+
"compose_text",
|
|
29
|
+
"cover_context",
|
|
30
|
+
"dark_humor",
|
|
31
|
+
"find",
|
|
32
|
+
"load_classifiers",
|
|
33
|
+
"load_lexicon",
|
|
34
|
+
"lookup",
|
|
35
|
+
"quadrat_groups",
|
|
36
|
+
"scan_text",
|
|
37
|
+
"pack_dir",
|
|
38
|
+
"__version__",
|
|
39
|
+
]
|
emojifics/__main__.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""CLI: python -m emojifics <command>"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main(argv: list[str] | None = None) -> int:
|
|
10
|
+
argv = sys.argv[1:] if argv is None else argv
|
|
11
|
+
try:
|
|
12
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
13
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
14
|
+
except (AttributeError, OSError):
|
|
15
|
+
pass
|
|
16
|
+
parser = argparse.ArgumentParser(
|
|
17
|
+
prog="python -m emojifics",
|
|
18
|
+
description=(
|
|
19
|
+
"Context to picture vars. Recipes in git. "
|
|
20
|
+
"install builds a local pack; binaries are never committed."
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
sub = parser.add_subparsers(dest="command")
|
|
24
|
+
|
|
25
|
+
inst = sub.add_parser(
|
|
26
|
+
"install",
|
|
27
|
+
help="Build the local pack (default: gitignored assets/set/)",
|
|
28
|
+
)
|
|
29
|
+
inst.add_argument(
|
|
30
|
+
"--pack-dir",
|
|
31
|
+
default=None,
|
|
32
|
+
help="Override pack directory (default: <repo>/assets/set, or EMOJIFICS_PACK)",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
comp = sub.add_parser(
|
|
36
|
+
"compose",
|
|
37
|
+
help="Compose a word from tags (classifier last, variable length)",
|
|
38
|
+
)
|
|
39
|
+
comp.add_argument(
|
|
40
|
+
"--text",
|
|
41
|
+
default=None,
|
|
42
|
+
help="Cover a phrase, post, or article. Length follows the source. Overrides positional tags.",
|
|
43
|
+
)
|
|
44
|
+
comp.add_argument("concepts", nargs="*", help="Concept tags in order")
|
|
45
|
+
comp.add_argument(
|
|
46
|
+
"--classifier",
|
|
47
|
+
default=None,
|
|
48
|
+
help="Optional classifier key (e.g. movies). Appended last.",
|
|
49
|
+
)
|
|
50
|
+
comp.add_argument(
|
|
51
|
+
"--script",
|
|
52
|
+
default="emoji",
|
|
53
|
+
choices=["emoji", "hiero", "both"],
|
|
54
|
+
help="Picture script (default emoji; hiero is parked)",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
look = sub.add_parser("lookup", help="Look up one or more sign keys")
|
|
58
|
+
look.add_argument("concepts", nargs="+")
|
|
59
|
+
look.add_argument(
|
|
60
|
+
"--script",
|
|
61
|
+
default="emoji",
|
|
62
|
+
choices=["emoji", "hiero", "both"],
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
found = sub.add_parser(
|
|
66
|
+
"find",
|
|
67
|
+
help="Search keys, aliases, classifiers, cues, notes, and emoji",
|
|
68
|
+
)
|
|
69
|
+
found.add_argument(
|
|
70
|
+
"query",
|
|
71
|
+
help="English or an emoji. Prints kind, name, key, and picture.",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
prev = sub.add_parser(
|
|
75
|
+
"preview",
|
|
76
|
+
help="Live examples gallery (compose from recipes, not README tables)",
|
|
77
|
+
)
|
|
78
|
+
prev.add_argument("--port", type=int, default=8767)
|
|
79
|
+
|
|
80
|
+
args = parser.parse_args(argv)
|
|
81
|
+
if args.command is None:
|
|
82
|
+
parser.print_help()
|
|
83
|
+
return 0
|
|
84
|
+
if args.command == "install":
|
|
85
|
+
from emojifics.install import install
|
|
86
|
+
|
|
87
|
+
path = install(pack_dir=args.pack_dir)
|
|
88
|
+
print(f"Pack ready: {path}")
|
|
89
|
+
print("Unicode chrome + signs.json. Nothing was downloaded.")
|
|
90
|
+
return 0
|
|
91
|
+
if args.command == "compose":
|
|
92
|
+
from emojifics.compose import compose, compose_text, print_examples
|
|
93
|
+
|
|
94
|
+
if args.text:
|
|
95
|
+
print(
|
|
96
|
+
compose_text(
|
|
97
|
+
args.text,
|
|
98
|
+
classifier=args.classifier,
|
|
99
|
+
script=args.script,
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
return 0
|
|
103
|
+
if not args.concepts:
|
|
104
|
+
print_examples()
|
|
105
|
+
return 0
|
|
106
|
+
print(
|
|
107
|
+
compose(
|
|
108
|
+
args.concepts,
|
|
109
|
+
classifier=args.classifier,
|
|
110
|
+
script=args.script,
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
return 0
|
|
114
|
+
if args.command == "lookup":
|
|
115
|
+
from emojifics.compose import lookup
|
|
116
|
+
|
|
117
|
+
for concept in args.concepts:
|
|
118
|
+
pic = lookup(concept, script=args.script)
|
|
119
|
+
print(f"{concept}: {pic if pic else '(none)'}")
|
|
120
|
+
return 0
|
|
121
|
+
if args.command == "find":
|
|
122
|
+
from emojifics.compose import find
|
|
123
|
+
|
|
124
|
+
rows = find(args.query)
|
|
125
|
+
if not rows:
|
|
126
|
+
print("(none)")
|
|
127
|
+
return 0
|
|
128
|
+
for hit in rows:
|
|
129
|
+
print(f"{hit.kind}\t{hit.name}\t{hit.key}\t{hit.emoji}")
|
|
130
|
+
return 0
|
|
131
|
+
if args.command == "preview":
|
|
132
|
+
from pathlib import Path
|
|
133
|
+
|
|
134
|
+
tools = Path(__file__).resolve().parent.parent / "tools"
|
|
135
|
+
if not (tools / "preview.py").is_file():
|
|
136
|
+
raise SystemExit(
|
|
137
|
+
"preview needs the git clone (tools/preview.py). "
|
|
138
|
+
"pip install -e . from the clone, then retry."
|
|
139
|
+
)
|
|
140
|
+
sys.path.insert(0, str(tools))
|
|
141
|
+
import preview as preview_gallery
|
|
142
|
+
|
|
143
|
+
preview_gallery.serve(port=args.port)
|
|
144
|
+
return 0
|
|
145
|
+
parser.print_help()
|
|
146
|
+
return 2
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
if __name__ == "__main__":
|
|
150
|
+
raise SystemExit(main())
|