Skip to content

Commit

Permalink
Improving words bag algo
Browse files Browse the repository at this point in the history
  • Loading branch information
mahomedalid committed Feb 24, 2024
1 parent f992b8a commit 3f1cc66
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli-dotnet-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
release_name="raccoonbits-$tag-${{ matrix.target }}"
# Build everything (--framework netcoreapp3.1)
dotnet publish RaccoonBitsCli/RaccoonBitsCli.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=true
dotnet publish RaccoonBitsCli/RaccoonBitsCli.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:PublishSingleFile=false --self-contained true
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
Expand Down
9 changes: 8 additions & 1 deletion RaccoonBitsCli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RaccoonBitsCore;
using System.IO;
using System.CommandLine.Parsing;
using System.CommandLine;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -239,6 +240,12 @@ static void ConfigureServices(ServiceCollection serviceCollection, string[] args
configure.SetMinimumLevel(LogLevel.Debug);
}
})
.AddSingleton((sp) => new Db("myprofile.db"))
.AddSingleton((sp) =>
{
string currentDirectory = Directory.GetCurrentDirectory();
string filePath = Path.Combine(currentDirectory, "myprofile.db");

return new Db(filePath);
})
.AddSingleton((sp) => new WeightsProfile());
}
1 change: 0 additions & 1 deletion RaccoonBitsCli/RaccoonBitsCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion RaccoonBitsCore/Db.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void CreateDb()
}

using (var command = new SQLiteCommand(
"CREATE TABLE posts(uri string PRIMARY KEY, jsonObject TEXT, wordsScore REAL, fameScore REAL, byzzScore REAL, buzzScore REAL, score REAL, boosted INTEGER, hostScore REAL)",
"CREATE TABLE posts(uri string PRIMARY KEY, jsonObject TEXT, wordsScore REAL, fameScore REAL, byzzScore REAL, buzzScore REAL, score REAL, boosted INTEGER, hostScore REAL, published_at INTEGER)",
connection))
{
command.ExecuteNonQuery();
Expand Down
44 changes: 3 additions & 41 deletions RaccoonBitsCore/FavoritesAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,46 +102,8 @@ public void Execute()
"see", "as", "way", "day", "could", "through", "our", "come", "back", "also",
"many", "even", "only", "new", "these", "first", "other", "two", "may", "should",
"over", "most", "people", "into", "year", "just", "some", "now", "than", "then",
"its", "down", "out", "when", "up", "time", "very", "after", "would", "them",
"some", "him", "into", "even", "look", "way", "year", "good", "our", "give",
"our", "under", "name", "very", "through", "just", "form", "much", "great",
"think", "say", "help", "low", "line", "before", "turn", "cause", "same", "mean",
"differ", "move", "right", "boy", "old", "too", "does", "tell", "sentence",
"set", "three", "want", "air", "well", "also", "play", "small", "end", "put",
"home", "read", "hand", "port", "large", "spell", "add", "even", "land", "here",
"must", "big", "high", "such", "follow", "act", "why", "ask", "men", "change",
"went", "light", "kind", "off", "need", "house", "picture", "try", "us", "again",
"animal", "point", "mother", "world", "near", "build", "self", "earth", "father",
"head", "stand", "own", "page", "should", "country", "found", "answer", "school",
"grow", "study", "still", "learn", "plant", "cover", "food", "sun", "four", "between",
"state", "keep", "eye", "never", "last", "let", "thought", "city", "tree", "cross",
"farm", "hard", "start", "might", "story", "saw", "far", "draw", "left", "late",
"run", "while", "press", "close", "night", "real", "life", "few", "stop", "open",
"seem", "together", "next", "white", "children", "begin", "got", "walk", "example",
"ease", "paper", "often", "always", "music", "those", "both", "mark", "book", "letter",
"until", "mile", "river", "car", "feet", "care", "second", "group", "carry", "took",
"rain", "eat", "room", "friend", "began", "idea", "fish", "mountain", "north", "once",
"base", "hear", "horse", "cut", "sure", "watch", "color", "face", "wood", "main", "enough",
"plain", "girl", "usual", "young", "ready", "above", "ever", "red", "list", "though",
"feel", "talk", "bird", "soon", "body", "dog", "family", "direct", "pose", "leave", "song",
"measure", "door", "product", "black", "short", "numeral", "class", "wind", "question",
"happen", "complete", "ship", "area", "half", "rock", "order", "fire", "south", "problem",
"piece", "told", "knew", "pass", "since", "top", "whole", "king", "space", "heard", "best",
"hour", "better", "true", "during", "hundred", "five", "remember", "step", "early", "hold",
"west", "ground", "interest", "reach", "fast", "verb", "sing", "listen", "six", "table",
"travel", "less", "morning", "ten", "simple", "several", "vowel", "toward", "war", "lay",
"against", "pattern", "slow", "center", "love", "person", "money", "serve", "appear",
"road", "map", "rain", "rule", "govern", "pull", "cold", "notice", "voice", "unit", "power",
"town", "fine", "certain", "fly", "fall", "lead", "cry", "dark", "machine", "note", "wait",
"plan", "figure", "star", "box", "noun", "field", "rest", "correct", "able", "pound", "done",
"beauty", "drive", "stood", "contain", "front", "teach", "week", "final", "gave", "green",
"oh", "quick", "develop", "ocean", "warm", "free", "minute", "strong", "special", "mind",
"behind", "clear", "tail", "produce", "fact", "street", "inch", "multiply", "nothing", "course",
"stay", "wheel", "full", "force", "blue", "object", "decide", "surface", "deep", "moon", "island",
"foot", "yet", "busy", "test", "record", "boat", "common", "gold", "possible", "plane", "stead",
"dry", "wonder", "laugh", "thousand", "ago", "ran", "check", "game", "shape", "equate", "hot",
"miss", "brought", "heat", "snow", "tire", "bring", "yes", "distant", "fill", "east", "paint",
"language", "among"
"its", "down", "out", "when", "up", "time", "very", "after", "would", "them", "some",
"because"
};

foreach (var kvp in frequentWords)
Expand All @@ -150,7 +112,7 @@ public void Execute()

if (commonWords.Contains(kvp.Key))
{
wordScore /= 3;
wordScore /= 4;
}

db.InsertOrReplaceWordScore(kvp.Key, (int)wordScore);
Expand Down
5 changes: 3 additions & 2 deletions RaccoonBitsCore/WeightsProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
{
public class WeightsProfile
{
public int TagsScore { get; set; } = 70;
public int MinimumFavoritesWordsCount { get; internal set; } = 5;
public int TagsScore { get; set; } = 75;

public int MinimumFavoritesWordsCount { get; internal set; } = 10;

public WeightsProfile()
{
Expand Down

0 comments on commit 3f1cc66

Please sign in to comment.