<commit_before># obj-file-parser
Open source, re-usable Wavefront 3D object file (.OBJ) parser written
in javascript and distributed freely as an NPM package.


## Features

  * Support for (.OBJ) files only, see mtl-file-parser for mtl files
  * Case insensitive, flexible parser
  * Simple JS object output


## Installation

```javascript
npm install --save obj-file-parser
```

## Usage

```javascript
const fileContents =
  'v 0 0 0 \n' +
  'v 0 1 0 \n' +
  'v 1 0 0 \n';

const objFile = new OBJFile(fileContents);

const output = objFile.parse(); // see description below
```


## Output
The extracted model and material library references
are returned in the following format:

```
{
  models: [
    {
      name: 'unit_cube',
      vertices: [
        { x: 1.0, 2.0, 3.0 },
        ...
      ],
      textureCoords: [
        { u: 1.0, v: 2.0, w: 3.0 },
        ...
      ],
      vertexNormals: [
        { x: 1.0, y: 2.0, z: 3.0 },
        ...
      ],
      faces: [
        {
          material: 'brick',
          vertices: [
            { vertexIndex: 1, textureCoordsIndex: 1, vertexNormalIndex: 1 },
            ...
          ]
        }
      ]
    },
    {
      ...
    }
  ],

  materialLibraries: [
    'mat_lib1.mtl',
    ...
  ]
}
```

## More to come
obj-file-parser is being actively maintained and developed, and is
expected to reach stability soon. Comments, feedback and bug reports
always welcome.

<commit_msg>Improve README sentence for Output section<commit_after># obj-file-parser
Open source, re-usable Wavefront 3D object file (.OBJ) parser written
in javascript and distributed freely as an NPM package.


## Features

  * Support for (.OBJ) files only, see mtl-file-parser for mtl files
  * Case insensitive, flexible parser
  * Simple JS object output


## Installation

```javascript
npm install --save obj-file-parser
```

## Usage

```javascript
const fileContents =
  'v 0 0 0 \n' +
  'v 0 1 0 \n' +
  'v 1 0 0 \n';

const objFile = new OBJFile(fileContents);

const output = objFile.parse(); // see description below
```


## Output
The extracted model data and list of material library references
are returned in the following format:

```
{
  models: [
    {
      name: 'unit_cube',
      vertices: [
        { x: 1.0, 2.0, 3.0 },
        ...
      ],
      textureCoords: [
        { u: 1.0, v: 2.0, w: 3.0 },
        ...
      ],
      vertexNormals: [
        { x: 1.0, y: 2.0, z: 3.0 },
        ...
      ],
      faces: [
        {
          material: 'brick',
          vertices: [
            { vertexIndex: 1, textureCoordsIndex: 1, vertexNormalIndex: 1 },
            ...
          ]
        }
      ]
    },
    {
      ...
    }
  ],

  materialLibraries: [
    'mat_lib1.mtl',
    ...
  ]
}
```

## More to come
obj-file-parser is being actively maintained and developed, and is
expected to reach stability soon. Comments, feedback and bug reports
always welcome.


{'fraction_non_alphanumeric': 0.12859097127222982, 'fraction_numerical': 0.02188782489740082, 'mean_word_length': 1.9635258358662615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2691795', 'n_tokens_mistral': 1014, 'n_tokens_neox': 927, 'n_words': 302}