-
Notifications
You must be signed in to change notification settings - Fork 31
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
Савенко Дмитрий #25
base: master
Are you sure you want to change the base?
Савенко Дмитрий #25
Conversation
private readonly ITagCloudLayouter _layouter; | ||
private readonly ITagCloudRenderer _renderer; | ||
|
||
public TagCloudGenerator(IWordProcessor wordProcessor, ITagCloudLayouter layouter, ITagCloudRenderer renderer) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
public void GenerateCloud(string inputFilePath, string outputFilePath, Size imageSize) | ||
{ | ||
var words = File.ReadAllLines(inputFilePath); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
var tags = wordFrequencies | ||
.OrderByDescending(pair => pair.Value) | ||
.Select(pair => new Tag(pair.Key, pair.Value)) | ||
.ToList(); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
foreach (var tag in tags) | ||
{ | ||
var size = new Size(tag.Frequency * 10, tag.Frequency * 10); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
public interface ITagCloudGenerator | ||
{ | ||
void GenerateCloud(string inputFilePath, string outputFilePath, Size imageSize); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
namespace TagsCloudContainer.DocumentReaders; | ||
|
||
public class DocxReader : IDocumentReader |
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.
Выглядит так, что ничем не отличается от DocReader
: можно было, наверное, сделать один WordDocumentReader
.
{ | ||
private readonly Dictionary<string, IDocumentReader> readers; | ||
|
||
public DocumentReaderFactory() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
public IDocumentReader GetReader(string filePath) | ||
{ | ||
var extension = Path.GetExtension(filePath).ToLower(); | ||
if (!readers.ContainsKey(extension)) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -0,0 +1,6 @@ | |||
namespace TagsCloudVisualization.Interfaces; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
return Math.Sqrt(dx * dx + dy * dy); | ||
} | ||
|
||
public static Point GetDirectionToCenter(this Point center, Rectangle rectangle) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
public static class RectangleExtensions | ||
{ | ||
public static double DistanceToCenter(this Rectangle rectangle, Point center) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -0,0 +1,31 @@ | |||
using System.Drawing; | |||
using TagsCloudVisualization; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
"is", "are", "was", "were", "be", "have", "has", "had", | ||
"this", "that", "these", "those", "my", "your", "his", "her", | ||
"their", "our", "its", "any", "all", "they", "we", "i", "you" | ||
}); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Ну и не очень хорошо в DI завязываться на имя параметра - он может поменяться и DI развалится.
Лучше делать через честное new:
builder.Register(c => new MyClass(c.Resolve<Parameter1>(), "custom string parameter", ...)) ...
|
||
result.Should().HaveCount(2); | ||
result.Should().Contain("hello"); | ||
result.Should().Contain("world"); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@SlavikGh0st