Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (12, 4) + inhomogeneous part. #202

Open

Description

in the grits.py file, when the code meet "pred_topology_grid = np.array(cells_to_relspan_grid(pred_cells))", some error occurs:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (12, 4) + inhomogeneous part.
`
def grits_from_html(true_html, pred_html):
"""
Compute GriTS_Con and GriTS_Top for two HTML sequences.
"""

metrics = {}
true_cells = html_to_cells(true_html)
pred_cells = html_to_cells(pred_html)
# Convert lists of cells to matrices of grid cells
true_topology_grid = np.array(cells_to_relspan_grid(true_cells))
pred_topology_grid = np.array(cells_to_relspan_grid(pred_cells))
true_text_grid = np.array(cells_to_grid(true_cells, key='cell_text'), dtype=object)
pred_text_grid = np.array(cells_to_grid(pred_cells, key='cell_text'), dtype=object)
grits_con, grits_precision_con, grits_recall_con,grits_con_upper_bound = grits_con(true_text_grid, pred_text_grid)
return grits_con, grits_precision_con, grits_recall_con,grits_con_upper_bound`

I suspect this issue might be caused by an inconsistent number of cells per row in my pred_html, which leads to some empty cells in the resulting grid. I was wondering if this scenario was considered when the metric was designed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /