Git Product home page Git Product logo

dialetus / dialetus-service Goto Github PK

View Code? Open in Web Editor NEW
255.0 11.0 88.0 2.3 MB

API to Informal dictionary for the idiomatic expressions that each Brazilian region It has

Home Page: https://dialetus-service.herokuapp.com

License: MIT License

Dockerfile 0.90% JavaScript 98.92% Shell 0.18%
nodejs api dialects brazilian-dialects javascript rest-api serverless yarn aws-lambda idiomatic-expressions serverless-offline aws dynamodb serverless-examples json dialects-mapped regions

dialetus-service's Introduction

CircleCI PRs Welcome GitHub license All Contributors

How did the idea come about?

The idea came about through the meeting of friends who only knew each other through the internet, each one with its linguistic-cultural traits, we thought of creating an informal dictionary for the idiomatic expressions that each Brazilian region possessed, so the project was totally collaborative, bringing cultural diversity from each one of us, being able, to deepen in the our Brazilian's daily culture.

Projects using the dialects-service

📃 API

All endpoints live under the URL https://dialetus-service.herokuapp.com and then generally follow the REST architecture.

All requests must be encoded as JSON with the Content-Type: application/json header. Most responses, including errors, are encoded exclusively as JSON as well.

Structure of dialect object

The dialect object in dialects folder has the following fields:

{
  "dialect": String,
  "meanings": Array<String>,
  "examples": Array<String>,
  "synonyms": Array<String> // (optional)
}

GET /regions

List all regions available with the total mapped dialects.

Request

$ curl https://dialetus-service.herokuapp.com/regions

Response

[{
  "name": "alagoanes",
  "total": 64
}, {
  "name": "amazones",
  "total": 9
}, {
  "name": "baianes",
  "total": 42
}, {
  "name": "carioques",
  "total": 14
}, {
  "name": "catarines",
  "total": 22
}, {
  "name": "cearences",
  "total": 10
}, {
  "name": "gauches",
  "total": 25
}, {
  "name": "lageanes",
  "total": 28
}, {
  "name": "maranhes",
  "total": 15
}, {
  "name": "mineires",
  "total": 26
}, {
  "name": "paraense",
  "total": 30
}, {
  "name": "paranes",
  "total": 53
}, {
  "name": "paulistes",
  "total": 16
}, {
  "name": "pernambuques",
  "total": 17
}, {
  "name": "piauies",
  "total": 30
}, {
  "name": "potiguares",
  "total": 35
}, {
  "name": "rondones",
  "total": 9
}, {
  "name": "sergipanes",
  "total": 11
}]

GET /regions/:region/dialects

List all dialects mapped.

Request

$ curl https://dialetus-service.herokuapp.com/regions/baianes/dialects

Response

[
  {
    "slug": "relaxe-mo-fiu",
    "dialect": "Relaxe mô fiu.",
    "meanings": [
      "Sem problemas",
      "Fique tranquilo"
    ],
    "examples": [
      "Ô vei, relaxe mô fiu todo nervoso ele."
    ]
  },
  {
    "slug": "e-bala",
    "dialect": "É bala!",
    "meanings": [
      "algo interessante",
      "massa"
    ],
    "examples": [
      "Que computador bala!"
    ]
  },
  {
    "slug": "comer-agua",
    "dialect": "Comer água!",
    "meanings": [
      "Vodka",
      "Cerveja",
      "Qualquer bebida que contenha álcool"
    ],
    "examples": [
      "Vamo pro reg comer água galera!"
    ]
  },
]

GET /regions/:region/dialects/:slug

Get a dialect by slug.

Request

$ curl https://dialetus-service.herokuapp.com/regions/baianes/dialects/relaxe-mo-fiu

Response

{
  "slug": "relaxe-mo-fiu",
  "dialect": "Relaxe mô fiu.",
  "meanings": [
    "Sem problemas",
    "Fique tranquilo"
  ],
  "examples": [
    "Ô vei, relaxe mô fiu todo nervoso ele."
  ]
}

GET /search?q={words}

Search the words in all dialects mapped.

Request

$ curl https://dialetus-service.herokuapp.com/search?q=regui

List of dialects

GET /dialect

GET /dialect

# /dialect/:region
GET /dialect/baianes
GET /dialect/mineires
GET /dialect/paranes
GET /dialect/carioques
GET /dialect/potiguares
GET /dialect/rondones
GET /dialect/cearences
GET /dialect/pernambuques
GET /dialect/piauies
GET /dialect/catarines
GET /dialect/paraense
GET /dialect/gauches

Response

{
  "baianes": [
    {
      "slug": "regui",
      "dialect": "Regui",
      "meanings": [
          "Reunião com os amigos",
          "Balada",
          "Festa"
      ],
      "examples": [
        "Ô mizera, bora pro regui logo vá!"
      ]
    },
    {
      "slug": "num-to-comeno-regui",
      "dialect": "Num tô comeno regui",
      "meanings": [
        "Não acreditar em algo",
        "Não se importar"
      ],
      "examples": [
        "Num tô comeno regui não viu pae."
      ]
    }
  ]
}

Request

$ curl https://dialetus-service.herokuapp.com/search?q=Virado no cão

Response

{
  "baianes": [{
    "slug": "virado-no-cao",
    "dialect": "Virado no cão",
    "meanings": [
      "Mal humorado",
      "Aborrecido"
    ],
    "examples": [
      "Eu to virado no cão, o primeiro que passar na minha frente vou rumaláporra!"
    ]
  }]
}

Request

$ curl https://dialetus-service.herokuapp.com/search?q=baita

Response

{
  "gauches": [{
    "slug": "baita",
    "dialect": "Baita",
    "meanings": [
      "Grande",
      "Imenso"
    ],
    "examples": [
      "Bah tchê, que baita de um problema tu arranjaste?!"
    ]
  }],
  "paranes": [{
    "slug": "baita",
    "dialect": "Baita",
    "meanings": [
      "grande",
      "enorme",
      "de grandes proporções"
    ],
    "examples": [
      "Mas que baita susto tu me deu"
    ]
  }]
}

GET /flags

List all flags of a dialects available.

Request

$ curl https://dialetus-service.herokuapp.com/flags

Response

{
    "flags": [
        {
            "key": "alagoanes",
            "url": "https://mydomain.com.br/database/flags/alagoanes.svg"
        },
        {
            "key": "amazones",
            "url": "https://mydomain.com.br/database/flags/amazones.svg"
        },
        {
            "key": "baianes",
            "url": "https://mydomain.com.br/database/flags/baianes.svg"
        },
        {
            "key": "carioques",
            "url": "https://mydomain.com.br/database/flags/carioques.svg"
        },
        {
            "key": "catarines",
            "url": "https://mydomain.com.br/database/flags/catarines.svg"
        },
        {
            "key": "cearences",
            "url": "https://mydomain.com.br/database/flags/cearences.svg"
        },
        {
            "key": "gauches",
            "url": "https://mydomain.com.br/database/flags/gauches.svg"
        },
        {
            "key": "lageanes",
            "url": "https://mydomain.com.br/database/flags/lageanes.svg"
        },
        {
            "key": "maranhes",
            "url": "https://mydomain.com.br/database/flags/maranhes.svg"
        },
        {
            "key": "mineires",
            "url": "https://mydomain.com.br/database/flags/mineires.svg"
        },
        {
            "key": "paraense",
            "url": "https://mydomain.com.br/database/flags/paraense.svg"
        },
        {
            "key": "paranes",
            "url": "https://mydomain.com.br/database/flags/paranes.svg"
        },
        {
            "key": "paulistes",
            "url": "https://mydomain.com.br/database/flags/paulistes.svg"
        },
        {
            "key": "pernambuques",
            "url": "https://mydomain.com.br/database/flags/pernambuques.svg"
        },
        {
            "key": "piauies",
            "url": "https://mydomain.com.br/database/flags/piauies.svg"
        },
        {
            "key": "potiguares",
            "url": "https://mydomain.com.br/database/flags/potiguares.svg"
        },
        {
            "key": "rondones",
            "url": "https://mydomain.com.br/database/flags/rondones.svg"
        },
        {
            "key": "sergipanes",
            "url": "https://mydomain.com.br/database/flags/sergipanes.svg"
        }
    ]
}

GET /flags/:key

Get a dialect flag by key.

Request

$ curl https://dialetus-service.herokuapp.com/flags/baianes

Response

{
    "flag": {
        "key": "baianes",
        "url": "https://mydomain.com.br/database/flags/baianes.svg"
    }
}

Contribute 🍕

01. Install dependencies

$ yarn

02. Create configs

Create a .env file at the root of the project. Make sure you follow the .env.example file as a guide.

03. Run project

$ yarn dev

04. Learn more in the Contributing guide

Please take a look at the contributing guide.

Respect earns Respect 👏

Please respect our Code of Conduct, in short:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

Authors 😎

Maintainers

Contributors 🎉

Thanks goes out to all these wonderful people (emoji key):


Marcus Silva

💻 📖 👀

Angelmário Santana

💻 📖 👀

Rodolfo Silva

💻 📖 👀

Bruno Pulis

💻

Wellington Mitrut

💻

Diego Ramos

💻

Caio Alcântara

💻

Lucas Farias

💻

Higor Morais

💻

Medson Mendes

💻

Randѕon Oliveira

💻

Murillo de Miranda Pereira

💻

Rafael Nunes

💻

Will Mendes

💻

kathleenrego

💻

Jader

💻

Rodolfo Candido

💻

Jefferson Moura

💻

Raphael Amorim

💻

Adriano Canofre

💻

Maurício Coelho

💻

Marcela Barella

💻

Matheus Monte

💻

Gabriel Kalani

💻

Ruan Kaylo

💻

Thiago Guimarães

💻

Welkson Ramos

💻

Mateus Malaquias

💻

License

Dialetus is released under the MIT license.

Copyright © 2019.

dialetus-service's People

Contributors

adrianocanofre avatar alvescleiton avatar anfsantana avatar angelobms avatar bgildson avatar bianavic avatar brunohgv avatar caiojhonny avatar clucasalcantara avatar davimoreiraa avatar dependabot[bot] avatar emanuelgsouza avatar erick2280 avatar fcoiuri avatar higorae avatar jacksjm avatar kaardeco avatar lmedson avatar lucasnasm avatar malaquiasdev avatar marcelabarella avatar mesps avatar murillo94 avatar mvfsillva avatar rdiego26 avatar rdl-candido avatar renovate[bot] avatar rodolfosilva avatar willmendesneto avatar wmitrut 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  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  avatar  avatar  avatar  avatar  avatar  avatar

dialetus-service's Issues

Update search endpoint response

We are change the frontend interface, based in that the search endpoint need migrate to a simple response.

Solution:

We must return status code 200 OK:

Sample:

[
  {
    "slug": "oxente",
    "dialect": "Oxente",
    "meanings": ["Surpresa", "Admiração"],
    "examples": ["Oxente mainha!"],
    "region": "baianes"
  },
  {
    "slug": "oxe",
    "dialect": "Oxe",
    "meanings": ["Espanto", "Surpresa"],
    "examples": ["Oxe, o que tu ta fazendo menino.", "Oxe, que negócio estranho boy"],
    "region": "pernambuques"
  },
  {
    "slug": "oxe",
    "dialect": "Oxe",
    "variations": ["baianes.Oxente"],
    "examples": ["Oxe omi!"],
    "region": "potiguares"
  }
]

Looking for an specific expression

First, congrats @mvfsillva! Awesome and fun project 👏👏👏
I was wondering if we can evolve the API in a way we can search for an specific expression.
I mean, there's some expressions which are used in different regions and sometimes it have the same meaning and sometimes don't.
It'll be nice if the API provides the ability of discovering.

Examples:

Request

curl https://dialetus-service.now.sh/search/bah

Response

]
  {
    "region": "gauches",
    "dialect": "Bah",
    "meanings": ["Tapada", "Lento", "Disperso"],
    "examples": ["Bah, sério?!"]
  }
]

Request

curl https://dialetus-service.now.sh/search/baita

Response

]
  {
    "region": "gauches",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Bah tchê, que baita de um problema tu arranjaste?!"]
  },
  {
    "region": "paulistes",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Meu, que baita de um problema!"]
  }
]

With this approach we can even provide a full search functionality:

Request

curl https://dialetus-service.now.sh/search/ba

Response

]
 {
    "region": "gauches",
        "dialect": "Bah",
        "meanings": ["Tapada", "Lento", "Disperso"],
        "examples": ["Bah, sério?!"]
  },
  {
    "region": "gauches",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Bah tchê, que baita de um problema tu arranjaste?!"]
  },
  {
    "region": "paulistes",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Meu, que baita de um problema!"]
  },
  {
    "region": "paulistes",
         "dialect": "Bagulho",
         "meanings": ["Qualquer tipo de objeto (lapis, papel, celular)"],
         "examples": ["Empresta esse bagulho ai pra mim?", "Passa essa bagulho ai mano!"]
  }
]

Or even better, we could group by regions in the response:

]
 {
    "region": "gauches"
        "dialects": [
         {
           "dialect": "Bah",
           "meanings": ["Tapada", "Lento", "Disperso"],
           "examples": ["Bah, sério?!"]
          },
         {
          "dialect": "Baita",
          "meanings": ["Grande", "Imenso"],
          "examples": ["Bah tchê, que baita de um problema tu arranjaste?!"]
         }
    ]
  }
]

This project and idea is so rich! That's a lot of applications and ways to scale.
E.g.: Integrate with dictionaries, etymology, audio expressions, and so on.
Cool!

Have you considered GraphQL?
Perhaps it could be a good alternative to amplify the service even more 🙂

New property

Is it possible to implement a new property of type image that represented the flag of each state? Can be called flag.
It's much better for UX to have flags in a GridView/ListView than just state names.

Each word have a synonyms

For each word, have a synonym section. For example: in the "Carioques" section, the word "Bolado" would have a synonymous word, "Chateado".

Meaning linking support

Add meaning link support

be able to link different meanings from different regions.
E.g.
Oxe Abreviation from Oxente

Api example

{
    dialect: "Oxente",
    meanings: [
        "surpresa",
        "admiração"
    ],
    examples: [
        "Oxente mainha!"
    ]
},

{
    dialect: "Oxe",
    originated: "baianês.Oxente"
    examples: [
        "Oxe omi!"
    ]
},

Hash table possibility instead a list

Premisse

For performance case and better scale of glossary, hash tables based information makes the key<->value match faster and easier to scale in matter of matching data through endpoints.

Case of today

GET and endpoint returns a list of objects for the dictionary, if I want to list them all, that's fine, if I need to match one specific word I have to run through the list looking for it.

Use of hash table

If data could be organised like this:

{
  barril: { dialect: 'barril', meanings: [ ... ], examples: [ ... ] },
  migue: { dialect, 'Migué', meanings: [ ... ], examples: [ ... ] }
}

If I want to understand some word, I would just do:

const barril = baianes['barril'];

That way the key<->value matching would be faster and easier to find a word inside the dictionary.

Other "wins" inside this decision

Organising .json files would be way easier, adding new words either. Instead of having a full file of it, you can place everything in a folder like:

dialects
\_ baianes
   \_ barril.json
   \_ migue.json
    ...etc
  • The root endpoint would get everything as a collection and display it in a hash table structure in order to show the full collection;
  • And now you can easily provide a deeper "foldering" endpoint to get specific words, like:
GET https://dialetus-service.now.sh/dialects/baianes/barril-dobrado

response example:

{
  barrilDobrado: {
    "dialect": "Barril Dobrado",
    "meanings": [
      "Problema muito grande",
      "Situação muito complicada",
      "Pessoa de grande Qualiadde"
    ],
    "examples": [
      "Isso ai é barril vey",
      "Você é barril dobrado meu pivete",
      "Eu sou barril dobrado"
    ]
  },
}

List of States in Brazil

I am using this issue to document data.

[
  {
    "uf": "AC",
    "label": "Acre",
    "draft": "false"
  },
  {
    "uf": "AL",
    "label": "Alagoas",
    "draft": "false"
  },
  {
    "uf": "AP",
    "label": "Amapá",
    "draft": "false"
  },
  {
    "uf": "AM",
    "label": "Amazonas",
    "draft": "false"
  },
  {
    "uf": "BA",
    "label": "Bahia",
    "draft": "false"
  },
  {
    "uf": "CE",
    "label": "Ceará",
    "draft": "false"
  },
  {
    "uf": "DF",
    "label": "Distrito Federal",
    "draft": "false"
  },
  {
    "uf": "ES",
    "label": "Espírito Santo",
    "draft": "false"
  },
  {
    "uf": "GO",
    "label": "Goiás",
    "draft": "false"
  },
  {
    "uf": "MA",
    "label": "Maranhão",
    "draft": "false"
  },
  {
    "uf": "MT",
    "label": "Mato Grosso",
    "draft": "false"
  },
  {
    "uf": "MS",
    "label": "Mato Grosso do Sul",
    "draft": "false"
  },
  {
    "uf": "MG",
    "label": "Minas Gerais",
    "draft": "false"
  },
  {
    "uf": "PA",
    "label": "Pará",
    "draft": "false"
  },
  {
    "uf": "PB",
    "label": "Paraíba",
    "draft": "false"
  },
  {
    "uf": "PR",
    "label": "Paraná",
    "draft": "false"
  },
  {
    "uf": "PE",
    "label": "Pernambuco",
    "draft": "false"
  },
  {
    "uf": "PI",
    "label": "Piauí",
    "draft": "false"
  },
  {
    "uf": "RJ",
    "label": "Rio de Janeiro",
    "draft": "false"
  },
  {
    "uf": "RN",
    "label": "Rio Grande do Norte",
    "draft": "false"
  },
  {
    "uf": "RS",
    "label": "Rio Grande do Sul",
    "draft": "false"
  },
  {
    "uf": "RO",
    "label": "Rondônia",
    "draft": "false"
  },
  {
    "uf": "RR",
    "label": "Roraima",
    "draft": "false"
  },
  {
    "uf": "SC",
    "label": "Santa Catarina",
    "draft": "false"
  },
  {
    "uf": "SP",
    "label": "São Paulo",
    "draft": "false"
  },
  {
    "uf": "SE",
    "label": "Sergipe",
    "draft": "false"
  },
  {
    "uf": "TO",
    "label": "Tocantins",
    "draft": "false"
  }
]

New property: Location

Sounds interesting to have a location property. It can be useful to UX/UI map related.

Some examples:
Pin all regions into a map
Open the location for some selected region

Change natales to potiguar

I would like to change the term "natales" to "potiguares", following the logic of "Bahia - baianes", "Minas Gerais - mineires", "Paraná - paranaes", and because it would open to a wide range of possibilities regarding to dialects from the country town.

Update the project to serverless

The focus of this update the project to works with serverless.

We will use the service bellow in AWS:

CloudFront
AWS S3 - Para salvar as flags
AWS XRAY
AWS Cloud Watch
AWS API Gateway
AWS Lambda
AWS Dynamodb

Intregation Diagram:

dialetus-service

Folders:

root 
 └ node_modules (auto-generated)    → NPM dependencies
 └ test                             → Pasta de teste que centraliza os testes unitários ou funcionais
 └ README.md                        → Arquivo que introduz e explica o projeto
 └ serverless.yml                   → Arquivo principal do Serverless Framework responsavel por configurar os ambientes e importar os arquivos functions.yml
 └ serverless.env.yml               → Arquivo que centraliza as variaveis de ambiente por stage
 └ src                              → Pasta principal com código de todo o projeto
   └ components                     → Comunicação do projeto com o mundo exterior (ex: banco de dados, fila, storage, arquivos locais "/tmp/")
     └ dynamodb                     
     └ s3     
     └ file   
     └ http 
     └ logger  
     └ xray       
   └ lib                            → Funções puras sem conexão externas que servem como ferramenta de "utilidades", por exemplo: String format, Date format, Regex processing, response wrapper, error handler e etc
     └ http                        
        └ handler-success            → Funções que moldam a response HTTP, por exemplo: handler de error para retornar uma status code HTTP especifico, controle de cache, cors, handler de sucesso para padronizar o objeto
        └ handler-error            → Funções que moldam a response HTTP, por exemplo: handler de error para retornar uma status code HTTP especifico, controle de cache, cors, handler de sucesso para padronizar o objeto
     └ string-utils                 
     └ date-utils                 
    └ functions                     →
      └ send-message                → Pasta da função/rota
        └ config.js                 → Módulo que importa as variaveis de ambiente para o scopo da função
        └ function.yml              → Configuração de recursos de função, como: nome da função, trigger da função, por exemplo: HTTP, schedule. sqs, tamanho da memória, cors
        └ handler.js                → Ponto de entrada de função, semelhante a um controller
        └ use-case                  → Modulo responsavel pelas regras de negocio
        └ serializer                → Serializa os dados internos para o modelo de resposta do mundo externo (basicamente cria o body da response)

List of initial libs:

dependencies:

devDependencies:

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.