Download app/Services/Chatbot/ParserService.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 830 Bytes
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Services/Chatbot/ParserService.php
- Command line
-
hf download hf://pnacorp/magicai/app/Services/Chatbot/ParserService.php
-
curl -L -o ParserService.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Services/Chatbot/ParserService.php
830 Bytes
| namespace App\Services\Chatbot; | |
| use Smalot\PdfParser\Parser; | |
| class ParserService | |
| { | |
| public string $text; | |
| public string $pdfPath; | |
| public function __construct( | |
| public Parser $parser | |
| ) {} | |
| public function parse(): string | |
| { | |
| $this->setText( | |
| $this->parser | |
| ->parseFile($this->getPdfPath()) | |
| ->getText() | |
| ); | |
| return $this->getText(); | |
| } | |
| public function setPdfPath(string $pdfPath): ParserService | |
| { | |
| $this->pdfPath = $pdfPath; | |
| return $this; | |
| } | |
| public function getPdfPath(): string | |
| { | |
| return $this->pdfPath; | |
| } | |
| public function getText(): string | |
| { | |
| return $this->text; | |
| } | |
| public function setText(string $text): void | |
| { | |
| $this->text = $text; | |
| } | |
| } | |