句子主题相似度判定算法开发需求及应用场景问询
I’m working on building an algorithm to assess whether a follow-up sentence fits into an existing narrative sequence. The core task is: given an initial starting sentence, determine if subsequent sentences are appropriate to add as complementary content that maintains the ongoing story or topic thread.
Judgment Examples
Valid starting sentence:
My dog loves to drink water.
This is a valid opening sentence that meets our baseline requirements.Fitting follow-up (shared subject):
The dog hates cats.
This sentence is acceptable—both the starting sentence and this one revolve around the core subject of "the dog," maintaining thematic consistency.Fitting follow-up (clear pronoun reference):
It enjoys walks on the beach.
This sentence works because the pronoun "it" clearly refers back to the dog established earlier, aligning with logical narrative flow.Non-fitting follow-up (off-topic):
Pizza is great with pineapple on top.
This sentence is not acceptable, as it completely breaks away from the dog-focused narrative thread built by the previous three sentences.
Context & Use Case
I’ve already built a library that generates Markov text chains from input text. After applying grammatical corrections, the library produces syntactically valid sentences—but I need a way to string these sentences together into coherent, thematically consistent paragraphs. This coherence-checking algorithm will be the key technical component to make that possible.
Content of this question originates from Stack Exchange, asked by Bryant Makes Programs

