ai test.py update
This commit is contained in:
parent
cbb64af17f
commit
9601a37c00
25
test.py
25
test.py
|
@ -1,11 +1,26 @@
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
|
from sqlalchemy.orm import joinedload
|
||||||
|
|
||||||
from ai.preprocess import get_clear_text
|
from ai.preprocess import get_clear_text
|
||||||
from base.orm import local_session
|
from base.orm import local_session
|
||||||
from orm import Shout
|
from orm import Shout, Topic
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
q = select(Shout)
|
q = select(Shout).options(
|
||||||
for [shout] in session.execute(q):
|
joinedload(Shout.authors),
|
||||||
clear_shout_body = get_clear_text(shout.body)
|
joinedload(Shout.topics),
|
||||||
print(clear_shout_body)
|
).where(
|
||||||
|
Shout.deletedAt.is_(None)
|
||||||
|
)
|
||||||
|
|
||||||
|
for [shout] in session.execute(q).unique():
|
||||||
|
print(shout.topics)
|
||||||
|
# clear_shout_body = get_clear_text(shout.body)
|
||||||
|
# print(clear_shout_body)
|
||||||
|
#
|
||||||
|
|
||||||
|
topics_q = select(Topic)
|
||||||
|
for [topic] in session.execute(topics_q):
|
||||||
|
print(topic.body)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user