Giter VIP home page Giter VIP logo

textutils's Introduction

TextUtils

A tool for analyzing text data in Django backend

It is a simple django project or website in which we can Analyze text.

What Can We do from Textutils ?

1)Remove Punctuations
2)UPPERCASE
3)New Line Remove
4)Extra Spaces Remover
5)Numbers Remover

Requirments

python3
django

textutils's People

Contributors

haris989 avatar harrycodewithharry avatar nikhilrajpandey avatar rohandas28 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

textutils's Issues

double spaces at the end of the string.

if we have double spaces at the end of the string then issue of out of bound would arise.

possible solution :
`elif(extraspaceremover=="on"):

    analyzed=re.sub(' +',' ', djtext)

    params = {'purpose': 'Removed NewLines', 'analyzed_text': analyzed}
    # Analyze the text
    return render(request, 'analyze.html', params)`

New Line Remover is not Working.

I am trying to remove new lines from my text and i an failing every time i have tried everything that i could if You Know the Solution so please tell me that.

how i can create order form

please help me
I have four models of the shop, customer, product, an order.
I am showing the relation of models

shop

   user = models.OneToOneField(User, null=True, related_name='shop', blank=True, on_delete=models.CASCADE)
   name = models.CharField(max_length=70, null=True, default='shop', )
   address = models.CharField(max_length=70, null=True)
   Shop_category = models.CharField(max_length=200, null=True, )

customer

  user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
  name = models.CharField(max_length=100, null=True, default='customer')
  Phone = models.PositiveIntegerField(blank=True, null=True)`

product

  shop = models.ForeignKey(Shop, models.CASCADE, null=True, blank=True)
  name = models.CharField(max_length=100, blank=True)
  Brand = models.CharField(max_length=200, blank=True)
  description = models.TextField(null=True, blank=True)

order

  shop = models.ForeignKey(Shop, models.CASCADE, null=True)
  customer = models.ForeignKey(Customer, models.CASCADE, null=True)
  product = models.ForeignKey(Product, models.CASCADE, null=True)
  quantity = models.CharField(max_length=30)
  date_created = models.DateTimeField(auto_now_add=True)
  status = models.CharField(max_length=200, choices=STATUS, default='Pending')
  note = models.CharField(max_length=1000, null=True)`

when customers login then the shop will print on the screen and a button on shop to show the products by the shop in the form card. On the product card, there is an order button that adds the product in order after submitting the selected product will print with the remaining filled of order. how I can create views.py

bugs with using multiple filters

If we add two filers both should be listed on the Analyze page, rather here only the later one in the list is displayed. Also, removed "NewLines" is a repetitive message for the last 3 actions which should be changed according to the operation. The same code is repeated in three HTML files used, rather a single file can be made with that and used. It'll not only improve the readability but will also facilitate easy changes to the design if any in future.

extraspaceremover

from django . http import HttpResponse
from django.shortcuts import render

def index(request):
return render(request, 'index.html')

def analyze(request):
#Get the text
djtext = request.POST.get('text', 'default')
#check the checkbox
removepunc = request.POST.get('removepunc', 'off')
extraspaceremover = request.POST.get('extraspaceremover','off')
fullcaps = request.POST.get('fullcaps', 'off')
newlineremover = request.POST.get('newlineremover', 'off')
countchar = request.POST.get('countchar', 'off')
numberremover = request.POST.get('numberremover','off')

print(fullcaps)
print(extraspaceremover)
print(removepunc)
print(djtext)

if (removepunc == "on"):
    punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
    analyzed = ""
    for char in djtext:
        if char not in punctuations:
            analyzed = analyzed + char

    params = {'purpose': 'Removed Punctuations', 'analyzed_text': analyzed}
    djtext = analyzed

if (extraspaceremover == "on"):
    analyzed = ""
    for index, char in enumerate(djtext):
        if not(djtext[index] == " " and djtext[index + 1] == " "):
            analyzed = analyzed + char

    params = {'purpose': 'EXTRA SPACES REMOVED', 'analyzed_text': analyzed}
    djtext = analyzed

if (fullcaps =="on"):
    analyzed = ""
    for char in djtext:
        analyzed = analyzed + char.upper()
        params = {'purpose': ' UPPER CASE', 'analyzed_text': analyzed}
        djtext = analyzed

if (newlineremover =="on"):
    analyzed = ""
    for char in djtext:
        if char !='\n' and char!='\r':
            analyzed = analyzed + char
    params = {'purpose': ' NEW LINE REMOVER', 'analyzed_text': analyzed}
    djtext = analyzed

if (countchar =="on"):
        analyzed = ""
        for char in djtext:
            analyzed = len(djtext)
        params = {'purpose': 'COUNT CHAR', 'analyzed_text': analyzed}
        djtext=analyzed

if (numberremover == "on"):
    analyzed = ""
    numbers = '0123456789'

    for char in djtext:
        if char not in numbers:
            analyzed = analyzed + char

        params = {'purpose': 'NUMBER REMOVED', 'analyzed_text': analyzed}
        djtext = analyzed

if (removepunc!="on" and fullcaps!= "on" and newlineremover!= "on" and extraspaceremover!= "on" and countchar!= "on" and numberremover!= "on"):
    return HttpResponse('Error')


return render(request, 'analyze.html', params)

on running this code it is giving an error

!!!!!!

Request Method: POST
http://127.0.0.1:8000/analyze
3.0.6
IndexError
string index out of range
C:\Users\hp\PycharmProjects\Textutils\Textutils\Textutils\views.py in analyze, line 44
C:\Users\hp\AppData\Local\Programs\Python\Python38\python.exe
3.8.3
['C:\Users\hp\PycharmProjects\Textutils\Textutils', 'C:\Users\hp\AppData\Local\Programs\Python\Python38\python38.zip', 'C:\Users\hp\AppData\Local\Programs\Python\Python38\DLLs', 'C:\Users\hp\AppData\Local\Programs\Python\Python38\lib', 'C:\Users\hp\AppData\Local\Programs\Python\Python38', 'C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages']

Purpose not showing correctly

The file views.py not showing the purpose or the function analyzed correctly and it just shows the only first analyzing function applied on the text and hides the next

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.