PHP code example of ianrothmann / ain-laravel-sdk

1. Go to this page and download the library: Download ianrothmann/ain-laravel-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ianrothmann / ain-laravel-sdk example snippets


    public function tldr()
    {
        $result=\Ain::TLdr()
            ->text($this->story)
            ->get();

        dd($result);
    }


    public function summarize()
    {
        $result=\Ain::summarize()
            ->text($this->story)
            ->inFirstPerson()
            ->forTargetGradeLevel(2)
            ->force()
            ->get();

        dd($result);
    }

    public function keywords()
    {
        $result=\Ain::extractKeywords()
            ->fromText($this->story)
            ->get();

        dd($result);
    }

    public function themes()
    {
        $result=\Ain::extractThemes()
            ->fromText($this->story)
            ->forContext('A person tells a story')
            ->get();

        dd($result);
    }

    public function sentiment()
    {
        $result=\Ain::classifySentiment()
            ->forSentences(['I like my dog','I dont like winter'])
            ->get();

        dd($result);
    }

    public function grammar()
    {
        $result=\Ain::languageCheck()
            ->text($this->spelling)
            ->get();

        dd($result);
    }

    public function rewriter()
    {
        $result=\Ain::rewrite()
            ->text($this->story)
            ->withHighCreativity()
            ->get();

        dd($result);
    }

    public function splitNames()
    {
        $result=\Ain::splitNames()
            ->forList(['Ian Rothmann','Hill, Peter'])
            ->get();

        dd($result);
    }