forked from algogrit/value-investing-with-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/dslipak/pdf" | ||
) | ||
|
||
// TODOs | ||
// 1. Figure out which file actually contains the statement (-0 vs -1) | ||
// Approach: | ||
// 2. Figure out if the year matches the statement title | ||
// 3. Extract the following data from the pdfs | ||
// - financial | ||
// - management | ||
// - text and tidbits (sentiment analysis) | ||
// 4. Build intelligence through analysis of past data & news reports & any other source | ||
|
||
func main() { | ||
// pdf.DebugOn = true | ||
content, err := readPdf("./statements/ASIANPAINT/2022-2023.pdf") // Read local pdf file | ||
if err != nil { | ||
panic(err) | ||
} | ||
fmt.Println(content) | ||
return | ||
} | ||
|
||
func readPdf(path string) (string, error) { | ||
r, err := pdf.Open(path) | ||
if err != nil { | ||
return "", err | ||
} | ||
totalPage := r.NumPage() | ||
|
||
for pageIndex := 1; pageIndex <= totalPage; pageIndex++ { | ||
p := r.Page(pageIndex) | ||
if p.V.IsNull() { | ||
continue | ||
} | ||
|
||
rows, _ := p.GetTextByRow() | ||
for _, row := range rows { | ||
println(">>>> row: ", row.Position) | ||
for _, word := range row.Content { | ||
fmt.Println(word.S) | ||
} | ||
} | ||
} | ||
return "", nil | ||
} |
This file contains 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
This file contains 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