Create working PoC of analysis

This commit is contained in:
2026-01-09 11:45:11 +01:00
parent 6860689299
commit fc86a44755
6 changed files with 36 additions and 12 deletions

View File

@@ -0,0 +1,5 @@
import morfeusz2
def analyse(text):
morf = morfeusz2.Morfeusz(expand_tags=True)
return morf.analyse(text)

View File

@@ -1,10 +0,0 @@
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, world"
def start():
app.run(port=3000)

View File

@@ -0,0 +1,16 @@
from flask import Flask
from conmorfeusz.web import analyzer
def create_app():
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev'
)
app.register_blueprint(analyzer.bp)
return app
def start():
app = create_app()
app.run()

View File

@@ -0,0 +1,12 @@
from flask import Blueprint, request
from conmorfeusz.service import analyzer as service
bp = Blueprint('analyser', __name__, url_prefix='/analyser')
@bp.post("/analyse")
def analyze():
data = request.get_json()
return {
"analysis": service.analyse(data["text"])
}

View File

@@ -13,8 +13,9 @@ dependencies = [
"flask"
]
[tool.setuptools]
packages = ["conmorfeusz"]
[tool.setuptools.packages.find]
where = ["."]
include = ["conmorfeusz*"]
[project.scripts]
conmorfeusz = "conmorfeusz.main:main"