-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/phrase search #6
base: main
Are you sure you want to change the base?
Conversation
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.
خسته نباشید
ArgumentNullException.ThrowIfNull(searcher); | ||
ArgumentNullException.ThrowIfNull(parser); | ||
_searcher = searcher; | ||
_parser = parser; |
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.
_searcher = searcher ?? throw new ArgumentNullException(nameof(searcher));
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.
به نظرمون روش ما readabilityش بالاتره
باز اگه دلیل خاصی براش دارین لطفا بیشتر توضیح بدین
var optionalWords = new List<Keyword>(); | ||
var excludedWords = new List<Keyword>(); | ||
|
||
var regex = new Regex(@"[+-]?\b\w+\b|[+-]?""[^""]+"""); |
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.
این میتونه const تعریف بشه یا حتی یک سرویس داشته باشیم که regexی که میخوایم رو provide میکنه
بهتره یه summary داشته باشیم که این ریجکس چیکار میکنه
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.
اصلاح شد
05-tdd/src/App/Utilities/Logging.cs
Outdated
|
||
public static class Logging | ||
{ | ||
public static ILogger Logger{get; private set;} |
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.
میتونه جنریک تعریف بشه که برای هر کلاس تایپ اونو بدیم
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.
ILogger<ClassType>
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.
اصلاح شد
HashSet<string> AllDocuments { get; } | ||
HashSet<string> GetDocumentsByKeyword(Keyword keyword); |
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.
اگه بخوایم مکان هر کلمه توی سند رو هم بدونیم و بخوایم توسعه بدیم لازم میشه ریترن تایپ رو عوض کنیم
در صورتی که بجای string میتونستیم یه تایپ از کلاس جدیدی که wrapper برای string هست ریترن کنیم (یعنی کلاسی که داخلش متغیر شماره سند باشه و بعدا بتونیم مثلا شماره خط یا.. هم اضافه کنیم)
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.
صرفا برای اینکه گوشه ذهنمون باشه گفتم نیاز به تغییرات نیست
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.
اوکی ممنون
private bool Equals(AdvancedInvertedIndex other) | ||
{ | ||
if (_invertedIndexMap.Count != other._invertedIndexMap.Count) | ||
return false; | ||
|
||
foreach (var kvp in _invertedIndexMap) | ||
{ | ||
if (!other._invertedIndexMap.TryGetValue(kvp.Key, out var otherSet)) | ||
return false; | ||
|
||
if (!kvp.Value.SetEquals(otherSet)) | ||
return false; | ||
} | ||
|
||
var areDocumentsEqual = AllDocuments.SetEquals(other.AllDocuments); | ||
return areDocumentsEqual; | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((AdvancedInvertedIndex)obj); | ||
} |
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.
چرا GetHashCode رو اورراید نکردیم؟ ارتباطش با Equals چیه؟
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.
نیازه این کلاس IEquatable رو هم ایمپلمنت کنه؟
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.
اینو تست کردیم؟
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.
اصلاح شد
Assert.Equal(["doc1"], documents1); | ||
Assert.Equal(["doc2"], documents2); |
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.
با SequenceEqual نمیشه؟
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.
میشه زد ولی خوانایی همین به نظرمون بهتره
|
||
yield return | ||
[ | ||
"-arshad -arshada ali", |
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.
😂❤️
|
||
[Theory] | ||
[MemberData(nameof(GetTestData))] | ||
public void ExtractKeywords_ShouldTokenizeText_WhenStringContainsSingleQuotation(string text, List<Keyword> expectedKeywords) |
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.
فکر کنم single quote + space باید باشه با توجه به تست کیس اول
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.
بهتر نبود delimitter رو کسی که میخواد tokenize کنه مشخص کنه
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.
اصلاح شد
No description provided.