PHPackages                             tinyporo/tf\_idf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tinyporo/tf\_idf

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tinyporo/tf\_idf
================

1.0.5(7y ago)051MITPHP

Since Aug 1Pushed 7y agoCompare

[ Source](https://github.com/TinyPoro/tf_idf)[ Packagist](https://packagist.org/packages/tinyporo/tf_idf)[ RSS](/packages/tinyporo-tf-idf/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Tf\_Idf
=======

[](#tf_idf)

### Sử dụng:

[](#sử-dụng)

1.Hàm khởi tạo nhận 2 tham số `TF_IDF($language, $α = 0.5, )`

- Khi tính tf sẽ sử dụng công thức sau để giảm sự ảnh hưởng của các câu dài

```
tf(t, d) = α + (1 − α)(ft,d/max(ft',d))

```

- α mặc định sẽ là 0,5. Bạn có thể truyền tham số α vào hàm khởi tạo.

2.Sử dụng hàm `addDocText` để thêm văn bản, hàm sẽ trả về `docId` tương ứng với văn bản bạn vừa thêm.

3.Sử dụng hàm `getTfIdf($term, $docId)` để lấy giá trị tf.idf của từ trong văn bản có id tương ứng.

4.Sử dụng hàm `getDocTfIdf($docId)` để lấy giá trị tf.idf của văn bản có id tương ứng.

### Lưu ý : Để có hiệu quả tốt

[](#lưu-ý--để-có-hiệu-quả-tốt)

1. Chỉ tính tf.idf với các danh từ
2. Cộng thêm điểm cho các câu có chứa từ trong title.
3. Áp dụng trọng số vị trí vào giá trị điểm cho bước 2 theo thang điểm \[0,1\]

###### [Tham khảo](http://research.nii.ac.jp/ntcir/workshop/OnlineProceedings3/NTCIR3-TSC-SekiY.pdf)

[](#tham-khảo)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

6

Last Release

2883d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f95c3d5b7647817cfac08d2eb6ca95cb81807e6d17c954b8dca48425d0c47d42?d=identicon)[TinyPoro](/maintainers/TinyPoro)

---

Top Contributors

[![TinyPoro](https://avatars.githubusercontent.com/u/20787476?v=4)](https://github.com/TinyPoro "TinyPoro (23 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tinyporo-tf-idf/health.svg)

```
[![Health](https://phpackages.com/badges/tinyporo-tf-idf/health.svg)](https://phpackages.com/packages/tinyporo-tf-idf)
```

###  Alternatives

[unicodeveloper/laravel-identify

A Laravel 5 Package Provider to Identify/detect a user's browser, device, operating system and Language

19222.0k](/packages/unicodeveloper-laravel-identify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
