-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Савельев Григорий #200
Open
luvairo-m
wants to merge
19
commits into
kontur-courses:master
Choose a base branch
from
luvairo-m:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Савельев Григорий #200
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
da15221
Initial commit
luvairo-m 0780e96
Переработка класса, отвечающего за отрисовку изображения. TagsCloudVi…
luvairo-m 73a2267
Добавление точки входа в программу. Замена Word => Tag
luvairo-m b22dab8
Добавление фильтров и источников информации.
luvairo-m 350b9c1
Правки в фильтрах.
luvairo-m b3a8bfe
Первая рабочая версия.
luvairo-m 6fe9c1d
Добавление переворотов слов.
luvairo-m 553449d
Добавлен CLI
luvairo-m a216c4e
Исправление ошибки ввода частей речи.
luvairo-m 554883b
Первые правки.
luvairo-m c9e8946
Reformat кода.
luvairo-m 5579be7
Reformat TagCloudVisualization.
luvairo-m 9965d1e
Новая структура.
luvairo-m 5ecfab1
Переработка фильтров. Расширение ServiceCollectionExtensions.
luvairo-m 4892a1e
Опции для процессоров теперь неизменяемые.
luvairo-m b2084cb
Устранение бага с переворотом слова и бага, связанного с регистром ис…
luvairo-m 609ddca
Реализация csvfilereader + docxfilereader.
luvairo-m f3c6de3
Сведение регистрации зависимостей к одному методу и добавление атрибу…
luvairo-m 2f385c6
Добавление тестов.
luvairo-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using TagsCloud.Contracts; | ||
using TagsCloud.Entities; | ||
using TagsCloud.Options; | ||
|
||
namespace TagsCloud.Builders; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using TagsCloudVisualization; | ||
|
||
namespace TagsCloud.Contracts; | ||
|
||
public interface ICloudProcessor | ||
{ | ||
void SetPositions(HashSet<WordTagGroup> wordGroups); | ||
void SetFonts(HashSet<WordTagGroup> wordGroups); | ||
void SetColors(HashSet<WordTagGroup> wordGroups); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using TagsCloudVisualization; | ||
|
||
namespace TagsCloud.Contracts; | ||
|
||
public interface IInputProcessor | ||
{ | ||
HashSet<WordTagGroup> CollectWordGroupsFromFile(string filename); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using TagsCloudVisualization; | ||
|
||
namespace TagsCloud.Contracts; | ||
|
||
public interface IOutputProcessor | ||
{ | ||
void SaveVisualization(HashSet<WordTagGroup> wordGroups, string filename); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace TagsCloud.CustomAttributes; | ||
|
||
[AttributeUsage(AttributeTargets.Class)] | ||
public class InjectionAttribute : Attribute | ||
{ | ||
public InjectionAttribute(ServiceLifetime lifeTime) | ||
{ | ||
LifeTime = lifeTime; | ||
} | ||
|
||
public ServiceLifetime LifeTime { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using TagsCloud.Contracts; | ||
using TagsCloud.CustomAttributes; | ||
using TagsCloud.Entities; | ||
|
||
namespace TagsCloud.FontMeasurers; | ||
|
||
[Injection(ServiceLifetime.Singleton)] | ||
public class LinearFontMeasurer : IFontMeasurer | ||
{ | ||
public MeasurerType Type => MeasurerType.Linear; | ||
|
||
public int GetFontSize(int count, int maxCount, int minCount, int maxSize, int minSize) | ||
public int GetFontSize(int wordFrequency, int minFrequency, int maxFrequency, int minFontSize, int maxFontSize) | ||
{ | ||
var fontSize = minSize + (float)count / maxCount * (maxSize - minSize); | ||
var fontSize = minFontSize + (float)wordFrequency / maxFrequency * (maxFontSize - minFontSize); | ||
return (int)fontSize; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using TagsCloud.Contracts; | ||
using TagsCloud.CustomAttributes; | ||
using TagsCloud.Entities; | ||
|
||
namespace TagsCloud.FontMeasurers; | ||
|
||
[Injection(ServiceLifetime.Singleton)] | ||
public class LogarithmicFontMeasurer : IFontMeasurer | ||
{ | ||
public MeasurerType Type => MeasurerType.Logarithmic; | ||
|
||
public int GetFontSize(int count, int maxCount, int minCount, int maxSize, int minSize) | ||
public int GetFontSize(int wordFrequency, int minFrequency, int maxFrequency, int minFontSize, int maxFontSize) | ||
{ | ||
var minLog = Math.Log(minCount); | ||
var divisor = Math.Log(maxCount) - minLog; | ||
var weight = divisor == 0 ? 1 : (Math.Log(count) - minLog) / divisor; | ||
return (int)(minSize + (maxSize - minSize) * weight); | ||
var minLog = Math.Log(minFrequency); | ||
var divisor = Math.Log(maxFrequency) - minLog; | ||
var weight = divisor == 0 ? 1 : (Math.Log(wordFrequency) - minLog) / divisor; | ||
return (int)(minFontSize + (maxFontSize - minFontSize) * weight); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using TagsCloud.Contracts; | ||
using TagsCloud.CustomAttributes; | ||
|
||
namespace TagsCloud.Formatters; | ||
|
||
[Injection(ServiceLifetime.Singleton)] | ||
public class DefaultPostFormatter : IPostFormatter | ||
{ | ||
private static readonly char[] separators = { ' ', '=', ';', ',', '.', ':', '!', '?' }; | ||
|
||
public string Format(string input) | ||
{ | ||
return input.Split(separators, StringSplitOptions.RemoveEmptyEntries)[0].ToLower(); | ||
var idx = GetFirstNonLetterIndex(input); | ||
return idx == -1 ? input : input[..idx]; | ||
} | ||
|
||
private static int GetFirstNonLetterIndex(string line) | ||
{ | ||
for (var i = 0; i < line.Length; i++) | ||
if (!char.IsLetter(line[i])) | ||
return i; | ||
|
||
return -1; | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
TagsCloud/Entities/CloudProcessorOptions.cs → TagsCloud/Options/CloudProcessorOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
TagsCloud/Entities/InputProcessorOptions.cs → TagsCloud/Options/InputProcessorOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Объясни, пожалуйста, разницу между
=>
и=
в данном случае?