Skip to content

Commit

Permalink
bag of words model
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanSears1 committed Apr 27, 2024
1 parent 8288fe0 commit 9222dd2
Show file tree
Hide file tree
Showing 5 changed files with 2,205 additions and 109 deletions.
34 changes: 9 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
# CMPS 6730 Sample Project

This repository contains starter code for the final project in CMPS 4730/6730: Natural Language Processing at Tulane University.

The code in this repository will be copied into your team's project repository at the start of class to provide a starting point for your project.

You should edit this file to include a summary of the goals, methods, and conclusions of your project.

The structure of the code supports the following:
# Your Terms: A text classifier that identifies potentially unfair or exploitative clauses in Terms and Conditions agreements

It's no secret that
- A simple web UI using Flask to support a demo of the project
- A command-line interface to support running different stages of the project's pipeline
- The ability to easily reproduce your work on another machine by using virtualenv and providing access to external data sources.

### Using this repository
### Exeriments


- At the start of the course, students will be divided into project teams. Each team will receive a copy of this starter code in a new repository. E.g.:
https://github.com/tulane-cmps6730/project-alpha
- Each team member will then clone their team repository to their personal computer to work on their project. E.g.: `git clone https://github.com/tulane-cmps6730/project-alpha`
- See [GettingStarted.md](GettingStarted.md) for instructions on using the starter code.
### Demo
To run the demo:
Move into the app directory with ```cd app```
Run the app with ```flask run```
This should run the flask app locally on your computer, so you should be able to use the demo at http://127.0.0.1:5000 (the port number may differ depending on your computer)


### Contents
Expand All @@ -28,15 +23,4 @@ https://github.com/tulane-cmps6730/project-alpha
- [report](report): LaTeX report
- [tests](tests): unit tests for project code

### Background Resources

The following will give you some technical background on the technologies used here:

1. Refresh your Python by completing this online tutorial: <https://www.learnpython.org/> (3 hours)
2. Create a GitHub account at <https://github.com/>
3. Setup git by following <https://help.github.com/en/articles/set-up-git> (30 minutes)
4. Learn git by completing the [Introduction to GitHub](https://lab.github.com/githubtraining/introduction-to-github) tutorial, reading the [git handbook](https://guides.github.com/introduction/git-handbook/), then completing the [Managing merge conflicts](https://lab.github.com/githubtraining/managing-merge-conflicts) tutorial (1 hour).
5. Install the Python data science stack from <https://www.anaconda.com/distribution/> . **We will use Python 3** (30 minutes)
6. Complete the scikit-learn tutorial from <https://www.datacamp.com/community/tutorials/machine-learning-python> (2 hours)
7. Understand how python packages work by going through the [Python Packaging User Guide](https://packaging.python.org/tutorials/) (you can skip the "Creating Documentation" section). (1 hour)
8. Complete Part 1 of the [Flask tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world), which is the library we will use for making a web demo for your project.
2 changes: 1 addition & 1 deletion app/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function makePrediction() {
$('#predictionResult').html('We did not identify any sentences as potentially unfair or exploitative.');
}
else {
$('#predictionResult').html('We identified the following sentences as potentially unfair or exploitative:\n');
$('#predictionResult').html('We identified the following sentence(s) as potentially unfair or exploitative:\n');
$.each(results, function(index, value) {
$('#positiveSentences').append('<li>' + value + '</li>');
});
Expand Down
28 changes: 28 additions & 0 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
font-family: Arial, sans-serif;
}
h1 {
text-align: center;
}
#predictionForm {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20px;
}
#textInput {
flex: auto;
width: 400px;
height: 200px;
margin-bottom: 10px;
}
#predictionResult {
text-align: center;
margin-top: 20px;
}
#positiveSentences {
margin-top: 20px;
padding-left: 20px;
}
</style>
</head>
<body>
<body>
Expand Down
Loading

0 comments on commit 9222dd2

Please sign in to comment.