Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions mempalace/entity_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from collections import defaultdict

from mempalace.i18n import get_entity_patterns
from mempalace.readable_extensions import ENTITY_DETECTOR_READABLE_EXTENSIONS


# ==================== LANGUAGE-AWARE PATTERN LOADING ====================
Expand Down Expand Up @@ -88,23 +89,7 @@ def _get_stopwords(languages: tuple) -> frozenset:
".csv",
}

READABLE_EXTENSIONS = {
".txt",
".md",
".py",
".js",
".ts",
".json",
".yaml",
".yml",
".csv",
".rst",
".toml",
".sh",
".rb",
".go",
".rs",
}
READABLE_EXTENSIONS = ENTITY_DETECTOR_READABLE_EXTENSIONS

SKIP_DIRS = {
".git",
Expand Down
25 changes: 2 additions & 23 deletions mempalace/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,9 @@
purge_file_closets,
upsert_closet_lines,
)
from .readable_extensions import MINER_READABLE_EXTENSIONS

READABLE_EXTENSIONS = {
".txt",
".md",
".py",
".js",
".ts",
".jsx",
".tsx",
".json",
".jsonl",
".yaml",
".yml",
".html",
".css",
".java",
".go",
".rs",
".rb",
".sh",
".csv",
".sql",
".toml",
}
READABLE_EXTENSIONS = MINER_READABLE_EXTENSIONS

SKIP_FILENAMES = {
"entities.json",
Expand Down
65 changes: 65 additions & 0 deletions mempalace/readable_extensions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""Shared readable-extension sets used by mining and entity detection."""

BASE_READABLE_EXTENSIONS = {
".txt",
".md",
".py",
".js",
".ts",
".json",
".yaml",
".yml",
".csv",
".toml",
".sh",
".rb",
".go",
".rs",
".c",
".cc",
".cpp",
".cxx",
".h",
".hh",
".hpp",
".hxx",
".ipp",
".inl",
".m",
".mm",
".cs",
".csproj",
".props",
".sln",
".vcxproj",
".kt",
".kts",
".erl",
".hrl",
".nix",
".cmake",
".gn",
".gni",
".proto",
".ps1",
".mdx",
".patch",
".ex",
".exs",
".eex",
".heex",
}

ENTITY_DETECTOR_READABLE_EXTENSIONS = BASE_READABLE_EXTENSIONS | {
".rst",
}

MINER_READABLE_EXTENSIONS = BASE_READABLE_EXTENSIONS | {
".jsx",
".tsx",
".jsonl",
".html",
".css",
".java",
".sql",
}