Resolve Issue #4229: "Author not detected in C++ file".#4983
Open
AdityaOP007 wants to merge 1 commit intoaboutcode-org:developfrom
Open
Resolve Issue #4229: "Author not detected in C++ file".#4983AdityaOP007 wants to merge 1 commit intoaboutcode-org:developfrom
AdityaOP007 wants to merge 1 commit intoaboutcode-org:developfrom
Conversation
…tion in C++ file working
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix author detection when "Author:" tag lacks trailing space (Issue #4229)
[
Input-
from cluecode.copyrights import detect_copyrights_from_lines
lines = [
(1, '// Date:9 April,2012'),
(2, '// Author:Frankie.Chu'),
(3, '// IDE Arduino-1.0')
]
results = list(detect_copyrights_from_lines(lines))
for r in results:
print(f'- {r.author} (Found on line {r.start_line})')
output-
Input Lines:
[(1, '// Date:9 April,2012'), (2, '// Author:Frankie.Chu'), (3, '// IDE Arduino-1.0')]
Detected Authors:
]
Changes made by Aditya regarding to Author detection (Issue #4229):
Token Normalization (
src/cluecode/copyrights.py):normalize_author_colonregex hook in theprepare_text_linepipeline to identify "Author:" or "author:" tags that are not immediately followed by whitespace.Author:NamebecomesAuthor: Name, allowing the tokenization engine to correctly isolate the author keyword from the name.Lexer enhancements (
src/cluecode/copyrights.py):(r'^[A-Z][a-z]+\.[A-Z][a-z]+$', 'NAME').Name.Namehandle structures (likeFrankie.Chu) as properNAMEentities instead of generic nouns (NN), allowing the existing NLP author detection grammar to successfully extract them.Testing (
tests/cluecode/test_copyrights_basic.py&tests/cluecode/data/authors/):prepare_text_linecorrectly normalizes spacing after colons without breaking existing correct formats.author_no_space_after_colon.cppand its YAML) mimicking the exact reported edge-case to prevent future regressions.