示例#1
0
 private function cut_word()
 {
     return ppython("topic::topic");
 }
                </div>

                <div class="row">
                    <h3>
                        Final Result is: <span style="color: red;" id = "finalResult"></span>
                    </h3>
                </div>

            </div>
        </div>

<?php 
$userInput = $_POST["userInput"];
if (!empty($userInput)) {
    require_once 'php_python.php';
    $result = ppython($userInput);
    $result = json_decode($result, true);
    $finalResult = $result["finalResult"];
    $rf_netural = $result["rf"]["netural"];
    $rf_positive = $result["rf"]["positive"];
    $rf_negative = $result["rf"]["negative"];
    $max_rf = $rf_netural;
    if ($max_rf < $rf_positive) {
        $max_rf = $rf_positive;
        if ($max_rf < $rf_negative) {
            $max_rf = $rf_negative;
            echo "\n                <script>\n                    document.getElementById(\"rf_negative\").innerHTML=\"<b style=\\\"color: red;\\\">" . $rf_negative . "</b>\";\n                    document.getElementById(\"rf_nature\").innerHTML=\"" . $rf_netural . "\";\n                    document.getElementById(\"rf_positive\").innerHTML=\"" . $rf_positive . "\";\n                </script>";
        } else {
            echo "\n                <script>\n                    document.getElementById(\"rf_positive\").innerHTML=\"<b style=\\\"color: red;\\\">" . $rf_positive . "</b>\";\n                    document.getElementById(\"rf_nature\").innerHTML=\"" . $rf_netural . "\";\n                    document.getElementById(\"rf_negative\").innerHTML=\"" . $rf_negative . "\";\n                </script>";
        }
    } elseif ($max_rf < $rf_negative) {