Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Asrom11
Copy link

@Asrom11 Asrom11 commented Dec 19, 2024

private readonly ITagCloudLayouter _layouter;
private readonly ITagCloudRenderer _renderer;

public TagCloudGenerator(IWordProcessor wordProcessor, ITagCloudLayouter layouter, ITagCloudRenderer renderer)

This comment was marked as resolved.


public void GenerateCloud(string inputFilePath, string outputFilePath, Size imageSize)
{
var words = File.ReadAllLines(inputFilePath);

This comment was marked as resolved.

var tags = wordFrequencies
.OrderByDescending(pair => pair.Value)
.Select(pair => new Tag(pair.Key, pair.Value))
.ToList();

This comment was marked as resolved.


foreach (var tag in tags)
{
var size = new Size(tag.Frequency * 10, tag.Frequency * 10);

This comment was marked as resolved.


public interface ITagCloudGenerator
{
void GenerateCloud(string inputFilePath, string outputFilePath, Size imageSize);

This comment was marked as resolved.


namespace TagsCloudContainer.DocumentReaders;

public class DocxReader : IDocumentReader
Copy link

@SlavikGh0st SlavikGh0st Jan 9, 2025

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.

public IDocumentReader GetReader(string filePath)
{
var extension = Path.GetExtension(filePath).ToLower();
if (!readers.ContainsKey(extension))

This comment was marked as resolved.

@@ -0,0 +1,6 @@
namespace TagsCloudVisualization.Interfaces;

This comment was marked as resolved.

return Math.Sqrt(dx * dx + dy * dy);
}

public static Point GetDirectionToCenter(this Point center, Rectangle rectangle)

This comment was marked as resolved.


public static class RectangleExtensions
{
public static double DistanceToCenter(this Rectangle rectangle, Point center)

This comment was marked as resolved.

@@ -0,0 +1,31 @@
using System.Drawing;
using TagsCloudVisualization;

This comment was marked as resolved.

"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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants