Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long text diff #86

Open
kouroshfar opened this issue Jul 19, 2024 · 3 comments
Open

Long text diff #86

kouroshfar opened this issue Jul 19, 2024 · 3 comments
Labels
question Just asking some questions

Comments

@kouroshfar
Copy link

kouroshfar commented Jul 19, 2024

Hi and thanks for your great library. I have a problem with long texts comparisons.
I have these configs:

// the Diff class options
$differOptions = [
    'context' => Differ::CONTEXT_ALL,
    'ignoreCase' => false,
    'ignoreLineEnding' => false,
    'ignoreWhitespace' => false,
    'lengthLimit' => 200000,
    'fullContextIfIdentical' => false,
];
// the renderer class options
$rendererOptions = [
    'detailLevel' => 'word',
    'language' => 'eng',
    'lineNumbers' => false,
    'separateBlock' => false,
    'showHeader' => false,
    'spacesToNbsp' => false,
    'tabSize' => 4,
    'mergeThreshold' => 0.8,
    'cliColorization' => RendererConstant::CLI_COLOR_AUTO,
    'outputTagAsString' => false,
    'jsonEncodeFlags' => \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE,
    'wordGlues' => [' ', '-'],
    'resultForIdenticals' => null,
    'wrapperClasses' => ['diff-wrapper '],
];
$rendererName = 'Combined';
$result = DiffHelper::calculate($old, $new, $rendererName, $differOptions, $rendererOptions);

And I wanted to compare these 2 texts:

New.txt
Old.txt

When the context set to Differ::CONTEXT_ALL it will not show the full text on the result.
I need to see the removed sentences and added sentences and also modified sentences too.

I need to have a result like this. Can you help me?
I've attached my result at the end of the issue too.

screenshot
screenshot

@jfcherng
Copy link
Owner

jfcherng commented Jul 19, 2024

When the context set to Differ::CONTEXT_ALL it will not show the full text on the result.

I don't notice anything unexpected with your options and sources.

Snipaste_2024-07-19_22-18-43

@jfcherng jfcherng added the question Just asking some questions label Jul 19, 2024
@kouroshfar
Copy link
Author

Thanks for your reply.
If you see my latest uploaded image, i have the result same as you.
But on the left column as you can see i have many sentences that they should show on the right column as a removed text (as we don't have them more), but we can't see.

screen

@jfcherng
Copy link
Owner

jfcherng commented Jul 19, 2024

But on the left column as you can see i have many sentences that they should show on the right column as a removed text (as we don't have them more), but we can't see.

That's not what you provided in old.txt / new.txt.

To save our time, use the demo example to provide results and point out what the issue is. I won't try anything other than the demo example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Just asking some questions
Projects
None yet
Development

No branches or pull requests

2 participants