-
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
1 changed file
with
34 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from perspective import Client, Attributes | ||
|
||
API_KEY = "AIzaSyA-yzvgANWE1STU9MTbTLrS3rj1956tVAs" | ||
|
||
""" | ||
+--------+-----------+ | ||
| Number | Level | | ||
+--------+-----------+ | ||
| 50 | CRITICAL | | ||
+--------+-----------+ | ||
| 40 | ERROR | | ||
+--------+-----------+ | ||
| 30 | WARNING | | ||
+--------+-----------+ | ||
| 20 | INFO | | ||
+--------+-----------+ | ||
| 10 | DEBUG | | ||
+--------+-----------+ | ||
| 0 | NOTSET | | ||
+--------+-----------+ | ||
""" | ||
|
||
# Set logging level to 20 (INFO) while creating the Client object | ||
perspective = Client(token = API_KEY, logging_level=20) | ||
|
||
# Modify logging level to 10 (DEBUG) which would show literally every logging message | ||
perspective.logging_level = 10 | ||
|
||
# Modify logging level again to 0 (NOTSET) which would disable logging | ||
perspective.logging_level = 0 | ||
|
||
response = perspective.analyze(text = "Never gonna give you up", attributes = Attributes.All, skip_on_lang=True, skip_on_unknown=False, return_raw=False) | ||
|
||
print(response) |