Ian Huang
Ian Huang

Reputation: 1

machine learning model to extract vectors from physics word problems

I’m working on a small project to extract vectors and their properties from physics word problems, such as magnitude, direction, and type, so they can be processed further. This project will replace the rules-based approach I currently use with spaCy by implementing a machine learning model. For example, given the text:

“Joe walks 2m north, then walks 3m east,”

I aim to extract the corresponding vector properties: magnitude, direction, and type. In this case, the correct output would be:

2m, north, displacement
3m, east, displacement

It would be incorrect, however, to extract 3N, north, displacement, and 2m, east, displacement as the 3m is associated with the east direction and vice versa. While our current method works for simpler sentences (such as the given sentence above), the variability in sentence structures has presented significant challenges that I believe machine learning could better address.

I saw online that this model can be done by a simple forward feeding structure and a binary classification. But I am very confused on how the training data and method should be. ChatGPT recommended the following structure for potential training data. Is this structure legit, I am also unsure how to access it with Keras.

this is the chatgpt generated json file

[

    {
        "context": [
            "A car moves with a speed of 50 km north, while another car moves 30 km east."
        ],
        "pairs": [
            {"magnitude": "50 km", "direction": "north", "label": 1},
            {"magnitude": "30 km", "direction": "east", "label": 1},
            {"magnitude": "50 km", "direction": "east", "label": 0},
            {"magnitude": "30 km", "direction": "north", "label": 0}
        ]
    },
    {
        "context": [
            "A car travels 40 km south. Later, it moves 20 km east."
        ],
        "pairs": [
            {"magnitude": "40 km", "direction": "south", "label": 1},
            {"magnitude": "20 km", "direction": "east", "label": 1},
            {"magnitude": "40 km", "direction": "east", "label": 0},
            {"magnitude": "20 km", "direction": "south", "label": 0}
        ]
    },
    {
        "context": [
            "A plane accelerates at 5 m/s^2 upwards and then decelerates at 3 m/s^2 westward."
        ],
        "pairs": [
            {"magnitude": "5 m/s^2", "direction": "upwards", "label": 1},
            {"magnitude": "3 m/s^2", "direction": "westward", "label": 1},
            {"magnitude": "5 m/s^2", "direction": "westward", "label": 0},
            {"magnitude": "3 m/s^2", "direction": "upwards", "label": 0}
        ]
    }
]

what would be the way to extract these vector properties and associate them accordingly?

Upvotes: -5

Views: 32

Answers (0)

Related Questions