Libraryless. Click here for Pure Java version (2760L/16K).
1 | // Search for some words in some texts and return a total score |
2 | static double scoredSearch_scoreWeighted(Iterable<S> l, LPair<S, Double> words) {
|
3 | double score = 0; |
4 | if (l != null) for (S s : l) |
5 | score += scoredSearch_scoreWeighted(s, words); |
6 | ret score; |
7 | } |
8 | |
9 | static double scoredSearch_scoreWeighted(S s, LPair<S, Double> words) {
|
10 | int score = 0; |
11 | if (nempty(s)) |
12 | for (S word, double weight : unpair words) |
13 | score += scoredSearch_score_single(s, word)*weight; |
14 | ret score; |
15 | } |
Began life as a copy of #1011593
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1030973 |
| Snippet name: | scoredSearch_scoreWeighted - where each search word has a weight |
| Eternal ID of this version: | #1030973/1 |
| Text MD5: | c37063cda9e2adcdb8097be4a9314978 |
| Transpilation MD5: | 275e96b4fb055390dedc304d20d8d53a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-04-17 14:03:21 |
| Source code size: | 503 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 353 / 475 |
| Referenced in: | [show references] |