This file contains hidden or 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
| threshold_factor = 0.8 | |
| threshold_positive = int(threshold_factor * len(features_positive)) | |
| threshold_negative = int(threshold_factor * len(features_negative)) | |
| features_train = features_positive[:threshold_positive]+features_negative[:threshold_negative] | |
| features_test = features_positive[threshold_positive:]+features_negative[threshold_negative:] |
This file contains hidden or 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
| classifier = NaiveBayesClassifier.train(features_train) | |
| pickle.dump(classifier,open('classifier.pkl','wb')) |
This file contains hidden or 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
| @app.route('/getText',methods=['POST']) | |
| def getText(): | |
| file=request.files['file'] | |
| text = ocr_extraction(file) | |
| # print(type(text)) | |
| sentiment = predictSentiment(text) | |
| print(sentiment) | |
| return jsonify(outputText=text,predSentiment=sentiment) |
This file contains hidden or 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
| classifier=pickle.load(open('classifier.pkl','rb')) | |
| def extract_features(word_list): | |
| return dict([(word, True) for word in word_list]) | |
| def predictSentiment(text): | |
| print('predict Sentiement',text) | |
| probdist = classifier.prob_classify(extract_features(text.split())) | |
| pred_sentiment = probdist.max() | |
| print("Predicted sentiment: ", pred_sentiment) |
This file contains hidden or 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
| import { NgModule } from '@angular/core'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { RouteReuseStrategy } from '@angular/router'; | |
| import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | |
| import { SplashScreen } from '@ionic-native/splash-screen/ngx'; | |
| import { StatusBar } from '@ionic-native/status-bar/ngx'; | |
| import { AppComponent } from './app.component'; | |
| import { AppRoutingModule } from './app-routing.module'; | |
| import { Crop } from '@ionic-native/crop/ngx'; | |
| import { File } from '@ionic-native/file/ngx'; |
This file contains hidden or 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
| //home.page.ts | |
| import { Component } from '@angular/core'; | |
| import { Camera, CameraOptions } from '@ionic-native/Camera/ngx'; | |
| import { Crop } from '@ionic-native/crop/ngx'; | |
| import { File } from '@ionic-native/file/ngx'; | |
| import { ActionSheetController } from '@ionic/angular'; | |
| @Component({ | |
| selector: 'app-home', | |
| templateUrl: 'home.page.html', | |
| styleUrls: ['home.page.scss'], |
This file contains hidden or 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
| import { NgModule } from '@angular/core'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { RouteReuseStrategy } from '@angular/router'; | |
| import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | |
| import { SplashScreen } from '@ionic-native/splash-screen/ngx'; | |
| import { StatusBar } from '@ionic-native/status-bar/ngx'; | |
| import { AppComponent } from './app.component'; | |
| import { AppRoutingModule } from './app-routing.module'; | |
| import { File } from '@ionic-native/file/ngx'; | |
| import { Camera } from '@ionic-native/Camera/ngx'; |
This file contains hidden or 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
| //home.page.ts | |
| import { Component } from '@angular/core'; | |
| import { Camera, CameraOptions } from '@ionic-native/Camera/ngx'; | |
| import { File } from '@ionic-native/file/ngx'; | |
| import { ActionSheetController } from '@ionic/angular'; | |
| @Component({ | |
| selector: 'app-home', | |
| templateUrl: 'home.page.html', | |
| styleUrls: ['home.page.scss'], | |
| }) |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or 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
| DATA_URL number 0 Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible | |
| FILE_URI number 1 Return file uri (content://media/external/images/media/2 for Android) | |
| NATIVE_URI number 2 Return native uri (eg. asset-library://... for iOS) |
This file contains hidden or 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
| DATA_URL | number | 0 | Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible | |
|---|---|---|---|---|
| FILE_URI | number | 1 | Return file uri (content://media/external/images/media/2 for Android) | |
| NATIVE_URI | number | 2 | Return native uri (eg. asset-library://... for iOS) |