-
Notifications
You must be signed in to change notification settings - Fork 89
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
1 parent
44c094b
commit e0c6dd1
Showing
7 changed files
with
214 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,35 @@ | ||
# 🧠 TextRazor API | ||
|
||
## Overview | ||
|
||
The **TextRazor API** provides powerful text analysis capabilities, allowing developers to extract insights and data from text. This API enables users to perform tasks such as entity extraction, sentiment analysis, and language detection, making it a valuable tool for applications that need to understand and process textual data. | ||
|
||
## Features | ||
|
||
- **Entity Extraction**: Identify and extract entities such as people, places, organizations, and more from text. | ||
- **Topic Extraction**: Automatically categorize and label text based on topics and themes. | ||
- **Sentiment Analysis**: Analyze the sentiment expressed in the text, determining whether it is positive, negative, or neutral. | ||
- **Language Detection**: Detect the language of the input text. | ||
- **Customizable**: Tailor the extraction and analysis to specific needs using custom configurations. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- **API Key**: You will need an API key to access the TextRazor API. You can obtain an API key by [signing up](https://www.textrazor.com/) on the TextRazor website. | ||
|
||
### Installation | ||
|
||
To use the TextRazor API in a web application, you can make HTTP requests to the API endpoint directly. Here’s an example of how to set it up in a basic HTML/JavaScript application: | ||
|
||
1. **Obtain Your API Key**: After signing up, you will receive an API key. | ||
|
||
2. **Make API Requests**: Use the API key to authenticate your requests to the TextRazor API endpoint (`https://api.textrazor.com/`). | ||
|
||
3. **Sample Request**: | ||
```bash | ||
curl -X POST https://api.textrazor.com/ \ | ||
-H 'x-textrazor-key: YOUR_API_KEY' \ | ||
-d 'text=Your sample text here&extractors=entities,topics' | ||
### Contributor | ||
### Amrutha Pariprolu |
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,25 @@ | ||
|
||
### `index.html` | ||
```html | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>TextRazor API App</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>TextRazor API App</h1> | ||
</header> | ||
<main> | ||
<form id="text-form"> | ||
<textarea id="text-input" placeholder="Enter text to analyze..."></textarea> | ||
<button type="submit">Analyze</button> | ||
</form> | ||
<div id="results"></div> | ||
</main> | ||
<script src="index.js"></script> | ||
</body> | ||
</html> |
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,39 @@ | ||
const apiKey = 'YOUR_TEXTRAZOR_API_KEY'; // Replace with your TextRazor API key | ||
const endpoint = 'https://api.textrazor.com/'; | ||
|
||
document.getElementById('text-form').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
const text = document.getElementById('text-input').value; | ||
if (text) { | ||
fetch(endpoint, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'x-textrazor-key': apiKey | ||
}, | ||
body: new URLSearchParams({ | ||
'text': text, | ||
'extractors': 'entities,topics' | ||
}) | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
const resultsContainer = document.getElementById('results'); | ||
resultsContainer.innerHTML = ''; | ||
if (data.response && data.response.entities) { | ||
const entities = data.response.entities.map(entity => ` | ||
<div class="result-item"> | ||
<h2>${entity.type}</h2> | ||
<p>${entity.mention}</p> | ||
</div> | ||
`).join(''); | ||
resultsContainer.innerHTML = `<h3>Entities:</h3>${entities}`; | ||
} else { | ||
resultsContainer.innerHTML = '<p>No entities found.</p>'; | ||
} | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching text analysis results:', error); | ||
}); | ||
} | ||
}); |
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,20 @@ | ||
{ | ||
"name": "TextRazor API App", | ||
"short_name": "TextRazor App", | ||
"start_url": "/", | ||
"display": "standalone", | ||
"background_color": "#ffffff", | ||
"theme_color": "#000000", | ||
"icons": [ | ||
{ | ||
"src": "icons/icon-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "icons/icon-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
{ | ||
"name": "textrazor-api-app", | ||
"version": "1.0.0", | ||
"description": "A simple web app that integrates with TextRazor API for text analysis functionality.", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "echo 'No start script defined'" | ||
}, | ||
"keywords": [ | ||
"text", | ||
"analysis", | ||
"textrazor", | ||
"api", | ||
"web" | ||
], | ||
"author": "Amrutha", | ||
"license": "MIT" | ||
} |
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,64 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f5f5f5; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
header { | ||
background-color: #000; | ||
color: #fff; | ||
width: 100%; | ||
text-align: center; | ||
padding: 10px; | ||
} | ||
|
||
main { | ||
margin-top: 20px; | ||
width: 80%; | ||
max-width: 800px; | ||
} | ||
|
||
#text-form { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
#text-input { | ||
width: 100%; | ||
height: 150px; | ||
padding: 10px; | ||
margin-bottom: 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
resize: vertical; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
border: none; | ||
background-color: #007bff; | ||
color: #fff; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
.result-item { | ||
margin-bottom: 20px; | ||
} | ||
|
||
.result-item h2 { | ||
margin: 0; | ||
} | ||
|
||
.result-item p { | ||
margin: 5px 0; | ||
} |