Java 程序结构建议

发布于 2024-08-04 03:56:03 字数 295 浏览 2 评论 0原文

我正在用 Java 构建和排序 RSS 阅读器,作为我的第一个面向对象程序,并且会喜欢一些 OO 设计技巧。

我有一个 Reader 类,其中包含 RSS 提要的 Feed 对象列表,每个 Feed 将新闻项下载到 Articles 列表中的 Article 对象中。

我想做的是找到一种方法来关联多个来源的文章。为此,每篇文章都有一个其关键字的哈希集,我想将所有文章的关键字相互比较并保留其匹配关键字的计数。如果两篇文章之间的计数非常高,我想将它们分组到输出中。

对文章进行“多对多”(?)比较并跟踪相对分数的有效方法是什么?

I am building and sort of RSS reader in java as my first object-oriented program and would love some OO design tips.

I have a Reader class with a list of Feed objects for RSS feeds, and each Feed downloads news items into Article objects in an Articles list.

What I want to do is find a way to relate articles from multiple sources. To do this, each Article has a HashSet of its keywords, and I would like to compare all article's keywords against each other and keep a count of their matched keywords. If the count between two articles is quite high, I would like to group them in the output.

What is an efficient way to do a 'many-to-many' (?) comparison of the articles and track relative scores?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

德意的啸 2024-08-11 03:56:03

数据库中的常见方法是使用一个“链接”对象(在数据库术语中通常称为“链接表”)将对象链接在一起。在这种情况下,您可能有一个“相关提要”对象,它将相关的元素链接在一起,也许它们的相关程度以及常用词等。如果不了解更多关于您具体想要做什么的信息,就很难可以说得更多,但一般来说,链接对象用于描述两个对象之间的关系 - 在这种情况下,为什么是它们如何相关,而不仅仅是它们相关。

A common approach in databases is to have a "linking" object, (commonly called a "link table" in database parlance) that links the objects together. In this case, you might have a "related feeds" object that would link together the elements that were related, maybe how closely related they were and the common words, etc. Without knowing more about what you want to do specifically, it is hard to say more, but in general linking objects are used to describe the relationship between two objects - in this, case the why of how they are related, not just that they are related.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文