lundi 31 juillet 2017

Suggest type of an object based on a given title

I am working on an Ember application that deals with geospatial data processing. Part of this project is importing a JSON object that describes a data layer which contains fields corresponding to data entries. For example, I suppose I am importing a data layer called "Laundry Facilities"; the JSON will look something like this:

 {
      key: "laundryFacilities",
      label: "Laundry Facilities",
      fields: [
        {
          "label": "Name of Facility",
          "key": "name",
        },
        {
          "label": "Number of Dryers",
          "key": "numberDryers",
        }
      ]
 }

At some point in my data import workflow, the user must specify a type for each field. For example, the type for "Name of Facility" would be a string, and the type for "Number of Dryers" would be an integer. I'd like to be able to provide a suggested type to the user based off of the label or key attribute rather than forcing them to specify the type for every field. Is there any kind of algorithm, package, framework, etc. that provides functionality for guessing a data type based off of something qualitative like a label describing the data field? Or does anyone know of another way I could implement this? I know not to expect 100% accuracy but even a rough type guess would be extremely helpful. Bonus points if it's an Ember addon.




Aucun commentaire:

Enregistrer un commentaire