-
Notifications
You must be signed in to change notification settings - Fork 47
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 connector md #88
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.
Please remove unrelated files(files inside .idea, etc) and update the gitignore to include those files.
import java.nio.file.Paths; | ||
|
||
/** Implementation of DocumentConnector for Md files. */ | ||
public class MdConnector extends DocumentConnector<MdReadOption> { |
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.
nit: MarkdownConnector
@@ -0,0 +1,29 @@ | |||
package ai.knowly.langtorch.connector.md; |
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.
nit: markdown
/** Implementation of ReadOption for Markdown files. */ | ||
@Data | ||
@Builder(toBuilder = true, setterPrefix = "set") | ||
public class MdReadOption implements ReadOption { |
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.
nit: MarkdownOption
import static com.google.common.truth.Truth.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class MdConnectorTest { |
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.
nit: MarkdownConnectorTest
/** Implementation of DocumentConnector for Md files. */ | ||
public class MdConnector extends DocumentConnector<MdReadOption> { | ||
private MdConnector(){}; | ||
|
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.
nit: remove ;
@Override | ||
protected String read(MdReadOption readOption) throws IOException { | ||
// Read the Markdown file content | ||
return new String(Files.readAllBytes(Paths.get(readOption.getFilePath()))); |
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.
adding charset
new String(
Files.readAllBytes(Paths.get(readOption.getFilePath())), StandardCharsets.UTF_8);
build.gradle
Outdated
@@ -120,6 +120,8 @@ dependencies { | |||
implementation 'org.apache.pdfbox:pdfbox:2.0.28' | |||
// Reading CSV | |||
implementation 'org.apache.commons:commons-csv:1.10.0' | |||
// Reading Markdown |
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.
this dependency is not used. please remove it.
Btw, could you update the package from "csv" to "spreadsheet"? |
Please also resolve the detected code smell issues |
Kudos, SonarCloud Quality Gate passed! |
This update implements the basic ability of the connector to read content from the md file