
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
dialog-reflection
Advanced tools
A library for dialog systems that attempt to respond to messages as Reflective Listening.
A library for dialog systems that attempt to respond to messages as Reflective Listening.
Need git and poetry to run this demo.
$ git clone git@github.com:sadahry/dialog-reflection.git
$ cd dialog-reflection
$ poetry install
$ poetry run python examples/interactive_ja.py
Need python >= 3.10
$ pip install dialog-reflection
SpaCyの日本語モデルのインストールが必要
ja_ginza==5.1.2 でテスト済$ pip install ja_ginza==5.1.2
実行例
from dialog_reflection.lang.ja.reflector import JaSpacyReflector
refactor = JaSpacyReflector(model="ja_ginza")
message = "今日は旅行へ行った"
reflection_text = refactor.reflect(message)
print(reflection_text)
# => 旅行へ行ったんですね。
Builderを使う例
from dialog_reflection.lang.ja.reflection_text_builder import (
JaSpacyPlainReflectionTextBuilder,
)
import spacy
nlp = spacy.load("ja_ginza")
builder = JaSpacyPlainReflectionTextBuilder()
message = "今日は旅行へ行った"
doc = nlp(message)
# some code...
reflection_text = builder.build(doc)
print(reflection_text)
# => 旅行へ行ったんですね。
op を変更することで語尾を調整可能
from dialog_reflection.lang.ja.reflector import JaSpacyReflector
from dialog_reflection.lang.ja.reflection_text_builder import (
JaSpacyPlainReflectionTextBuilder,
)
from dialog_reflection.lang.ja.reflection_text_builder_option import (
JaSpacyPlainReflectionTextBuilderOption,
)
refactor = JaSpacyReflector(
model="ja_ginza",
builder=JaSpacyPlainReflectionTextBuilder(
op=JaSpacyPlainRelflectionTextBuilderOption(
fn_last_token_taigen=lambda token: token.text + "なんだね。",
fn_last_token_yougen=lambda token: token.lemma_ + "んだね。",
)
),
)
message = "今日は旅行へ行った"
reflection_text = refactor.reflect(message)
print(reflection_text)
# => 旅行へ行ったんだね。
その他設定項目は reflection_text_builder_option.py を確認してください
JaSpacyPlainReflectionTextBuilder を override することでロジックをカスタマイズ可能
from dialog_reflection.reflection_cancelled import (
ReflectionCancelled,
)
from dialog_reflection.cancelled_reason import (
NoValidSentence,
)
from dialog_reflection.lang.ja.reflector import JaSpacyReflector
from dialog_reflection.lang.ja.reflection_text_builder import (
JaSpacyPlainReflectionTextBuilder,
)
import spacy
class CustomReflectionTextBuilder(JaSpacyPlainReflectionTextBuilder):
def extract_tokens(self, doc: spacy.tokens.Doc) -> spacy.tokens.Span:
propn_token = next(filter(lambda token: token.pos_ == "PROPN", doc), None)
if propn_token is None:
raise ReflectionCancelled(reason=NoValidSentence(doc=doc))
if propn_token.dep_ in ["compound", "numpound"]:
return doc[propn_token.i : propn_token.head.i + 1]
return doc[propn_token.i : propn_token.i + 1]
refactor = JaSpacyReflector(
model="ja_ginza",
builder=CustomReflectionTextBuilder(),
)
message = "今日は田中さんと旅行へ行った"
reflection_text = refactor.reflect(message)
print(reflection_text)
# => 田中さんなんですね。
FAQs
A library for dialog systems that attempt to respond to messages as Reflective Listening.
We found that dialog-reflection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.